Azure Databases API Documentation

Introduction

This documentation outlines the REST API endpoints for managing various Azure database services. You can perform operations such as creating, retrieving, updating, and deleting database resources, configuring servers, and managing data across different Azure database offerings.

The API uses standard HTTP methods (GET, POST, PUT, DELETE) and returns responses in JSON format. Authentication is typically handled via Azure Active Directory (now Microsoft Entra ID) or service principals. Ensure you have the necessary permissions to perform the requested operations.

Azure SQL Database

Manage your relational databases hosted on Azure SQL Database.

List Databases

GET
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases

Retrieves a list of all Azure SQL Databases within a specified server.

Parameters

Name In Type Description Required
subscriptionIdpathstringThe ID of the target subscription.Yes
resourceGroupNamepathstringThe name of the resource group.Yes
serverNamepathstringThe name of the Azure SQL server.Yes

Responses

CodeDescriptionSchema
200 OK Successfully retrieved the list of databases. DatabaseListResult
404 Not Found The specified server or resource group was not found. ErrorResponse

Create Database

PUT
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}

Creates or updates an Azure SQL Database.

Parameters

NameInTypeDescriptionRequired
subscriptionIdpathstringThe ID of the target subscription.Yes
resourceGroupNamepathstringThe name of the resource group.Yes
serverNamepathstringThe name of the Azure SQL server.Yes
databaseNamepathstringThe name of the database to create or update.Yes

Request Body

Represents a database resource.

{
  "location": "string",
  "sku": {
    "name": "string",
    "tier": "string",
    "capacity": 0,
    "family": "string",
    "size": "string"
  },
  "collation": "string",
  "maxSizeBytes": 0,
  "tags": {
    "additionalProperties": "string"
  }
}

Responses

CodeDescriptionSchema
201 Created Database created successfully. Database
200 OK Database updated successfully. Database
400 Bad Request Invalid request payload. ErrorResponse

Get Database

GET
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}

Retrieves a specific Azure SQL Database by name.

Parameters

NameInTypeDescriptionRequired
subscriptionIdpathstringThe ID of the target subscription.Yes
resourceGroupNamepathstringThe name of the resource group.Yes
serverNamepathstringThe name of the Azure SQL server.Yes
databaseNamepathstringThe name of the database to retrieve.Yes

Responses

CodeDescriptionSchema
200 OK Successfully retrieved the database details. Database
404 Not Found The specified database was not found. ErrorResponse

Update Database

PATCH
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}

Updates an existing Azure SQL Database. Only properties specified in the request body will be updated.

Parameters

NameInTypeDescriptionRequired
subscriptionIdpathstringThe ID of the target subscription.Yes
resourceGroupNamepathstringThe name of the resource group.Yes
serverNamepathstringThe name of the Azure SQL server.Yes
databaseNamepathstringThe name of the database to update.Yes

Request Body

Represents properties that can be updated for a database resource.

{
  "sku": {
    "name": "string",
    "tier": "string",
    "capacity": 0,
    "family": "string",
    "size": "string"
  },
  "tags": {
    "additionalProperties": "string"
  }
}

Responses

CodeDescriptionSchema
200 OK Database updated successfully. Database
404 Not Found The specified database was not found. ErrorResponse

Delete Database

DELETE
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}

Deletes an Azure SQL Database.

Parameters

NameInTypeDescriptionRequired
subscriptionIdpathstringThe ID of the target subscription.Yes
resourceGroupNamepathstringThe name of the resource group.Yes
serverNamepathstringThe name of the Azure SQL server.Yes
databaseNamepathstringThe name of the database to delete.Yes

Responses

CodeDescriptionSchema
204 No Content Database deleted successfully. (No content)
404 Not Found The specified database was not found. ErrorResponse

Azure Cosmos DB

Manage your globally distributed, multi-model NoSQL database service.

List Cosmos DB Accounts

GET
/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts

Lists all database accounts within a subscription.

Parameters

NameInTypeDescriptionRequired
subscriptionIdpathstringThe ID of the target subscription.Yes

Responses

CodeDescriptionSchema
200 OK Successfully retrieved the list of database accounts. DatabaseAccountListResult

Create Cosmos DB Account

PUT
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}

Creates or updates a Cosmos DB database account.

Parameters

NameInTypeDescriptionRequired
subscriptionIdpathstringThe ID of the target subscription.Yes
resourceGroupNamepathstringThe name of the resource group.Yes
accountNamepathstringThe name of the database account.Yes

Request Body

Represents a Cosmos DB database account.

{
  "location": "string",
  "kind": "GlobalDocumentDB",
  "properties": {
    "databaseAccountOfferType": "Standard",
    "locations": [
      {
        "locationName": "string",
        "failoverPriority": 0,
        "isZoneRedundant": true
      }
    ],
    "consistencyPolicy": {
      "defaultConsistencyLevel": "Strong"
    },
    "tags": {
      "additionalProperties": "string"
    }
  }
}

Responses

CodeDescriptionSchema
201 Created Database account created successfully. DatabaseAccount
200 OK Database account updated successfully. DatabaseAccount

Get Cosmos DB Account

GET
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}

Retrieves the details of a specific Cosmos DB database account.

Parameters

NameInTypeDescriptionRequired
subscriptionIdpathstringThe ID of the target subscription.Yes
resourceGroupNamepathstringThe name of the resource group.Yes
accountNamepathstringThe name of the database account.Yes

Responses

CodeDescriptionSchema
200 OK Successfully retrieved database account details. DatabaseAccount
404 Not Found The specified database account was not found. ErrorResponse

List Databases in Cosmos DB Account

GET
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/{apiKind}/databases

Lists all databases within a specific Cosmos DB account for a given API kind (e.g., `Sql`).

Parameters

NameInTypeDescriptionRequired
subscriptionIdpathstringThe ID of the target subscription.Yes
resourceGroupNamepathstringThe name of the resource group.Yes
accountNamepathstringThe name of the Cosmos DB database account.Yes
apiKindpathstringThe API kind (e.g., Sql, MongoDB, Cassandra).Yes

Responses

CodeDescriptionSchema
200 OK Successfully retrieved the list of databases. DatabaseListResult

Create Database in Cosmos DB Account

POST
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/{apiKind}/databases

Creates a new database within a Cosmos DB account for a given API kind.

Parameters

NameInTypeDescriptionRequired
subscriptionIdpathstringThe ID of the target subscription.Yes
resourceGroupNamepathstringThe name of the resource group.Yes
accountNamepathstringThe name of the Cosmos DB database account.Yes
apiKindpathstringThe API kind (e.g., Sql).Yes

Request Body

Represents a database resource within Cosmos DB.

{
  "id": "string",
  "resource": {
    "id": "string"
  },
  "rid": "string",
  "ts": 0,
  "etag": "string",
  "attachments": "string",
  "self": "string"
}

Responses

CodeDescriptionSchema
201 Created Database created successfully. Database

Azure Database for PostgreSQL

Managed PostgreSQL service that enables you to run, manage, and connect to PostgreSQL databases in the cloud.

List PostgreSQL Servers

GET
/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/servers

Lists all PostgreSQL servers in the current subscription.

Parameters

NameInTypeDescriptionRequired
subscriptionIdpathstringThe ID of the target subscription.Yes

Responses

CodeDescriptionSchema
200 OK Successfully retrieved the list of servers. ServerListResult

Create PostgreSQL Server

PUT
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}

Creates a new PostgreSQL server or updates an existing one.

Parameters

NameInTypeDescriptionRequired
subscriptionIdpathstringThe ID of the target subscription.Yes
resourceGroupNamepathstringThe name of the resource group.Yes
serverNamepathstringThe name of the server to create.Yes

Request Body

Represents a PostgreSQL server resource.

{
  "location": "string",
  "sku": {
    "name": "string",
    "tier": "string",
    "capacity": 0
  },
  "properties": {
    "version": "11",
    "administratorLogin": "string",
    "administratorLoginPassword": "string",
    "storageProfile": {
      "storageMB": 0,
      "backupRetentionDays": 0,
      "geoRedundantBackup": "Enabled"
    },
    "tags": {
      "additionalProperties": "string"
    }
  }
}

Responses

CodeDescriptionSchema
201 Created Server created successfully. Server
200 OK Server updated successfully. Server

Get PostgreSQL Server

GET
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}

Retrieves the details of a specific PostgreSQL server.

Parameters

NameInTypeDescriptionRequired
subscriptionIdpathstringThe ID of the target subscription.Yes
resourceGroupNamepathstringThe name of the resource group.Yes
serverNamepathstringThe name of the PostgreSQL server.Yes

Responses

CodeDescriptionSchema
200 OK Successfully retrieved server details. Server
404 Not Found The specified server was not found. ErrorResponse

Azure Database for MySQL

Managed MySQL service that enables you to run, manage, and connect to MySQL databases in the cloud.

List MySQL Servers

GET
/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/servers

Lists all MySQL servers in the current subscription.

Parameters

NameInTypeDescriptionRequired
subscriptionIdpathstringThe ID of the target subscription.Yes

Responses

CodeDescriptionSchema
200 OK Successfully retrieved the list of servers. ServerListResult

Create MySQL Server

PUT
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}

Creates a new MySQL server or updates an existing one.

Parameters

NameInTypeDescriptionRequired
subscriptionIdpathstringThe ID of the target subscription.Yes
resourceGroupNamepathstringThe name of the resource group.Yes
serverNamepathstringThe name of the server to create.Yes

Request Body

Represents a MySQL server resource.

{
  "location": "string",
  "sku": {
    "name": "string",
    "tier": "string",
    "capacity": 0
  },
  "properties": {
    "version": "5.7",
    "administratorLogin": "string",
    "administratorLoginPassword": "string",
    "storageProfile": {
      "storageMB": 0,
      "backupRetentionDays": 0,
      "geoRedundantBackup": "Disabled"
    },
    "tags": {
      "additionalProperties": "string"
    }
  }
}

Responses

CodeDescriptionSchema
201 Created Server created successfully. Server
200 OK Server updated successfully. Server

Get MySQL Server

GET
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}

Retrieves the details of a specific MySQL server.

Parameters

NameInTypeDescriptionRequired
subscriptionIdpathstringThe ID of the target subscription.Yes
resourceGroupNamepathstringThe name of the resource group.Yes
serverNamepathstringThe name of the MySQL server.Yes

Responses

CodeDescriptionSchema
200 OK Successfully retrieved server details. Server
404 Not Found The specified server was not found. ErrorResponse

Azure Database for MariaDB

Managed MariaDB service that enables you to run, manage, and connect to MariaDB databases in the cloud.

List MariaDB Servers

GET
/subscriptions/{subscriptionId}/providers/Microsoft.DBforMariaDB/servers

Lists all MariaDB servers in the current subscription.

Parameters

NameInTypeDescriptionRequired
subscriptionIdpathstringThe ID of the target subscription.Yes

Responses

CodeDescriptionSchema
200 OK Successfully retrieved the list of servers. ServerListResult

Create MariaDB Server

PUT
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}

Creates a new MariaDB server or updates an existing one.

Parameters

NameInTypeDescriptionRequired
subscriptionIdpathstringThe ID of the target subscription.Yes
resourceGroupNamepathstringThe name of the resource group.Yes
serverNamepathstringThe name of the server to create.Yes

Request Body

Represents a MariaDB server resource.

{
  "location": "string",
  "sku": {
    "name": "string",
    "tier": "string",
    "capacity": 0
  },
  "properties": {
    "version": "10.3",
    "administratorLogin": "string",
    "administratorLoginPassword": "string",
    "storageProfile": {
      "storageMB": 0,
      "backupRetentionDays": 0,
      "geoRedundantBackup": "Disabled"
    },
    "tags": {
      "additionalProperties": "string"
    }
  }
}

Responses

CodeDescriptionSchema
201 Created Server created successfully. Server
200 OK Server updated successfully. Server

Get MariaDB Server

GET
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}

Retrieves the details of a specific MariaDB server.

Parameters

NameInTypeDescriptionRequired
subscriptionIdpathstringThe ID of the target subscription.Yes
resourceGroupNamepathstringThe name of the resource group.Yes
serverNamepathstringThe name of the MariaDB server.Yes

Responses

CodeDescriptionSchema
200 OK Successfully retrieved server details. Server
404 Not Found The specified server was not found. ErrorResponse