Azure SQL Database Management REST API Reference

This reference documentation provides details on the REST API operations available for managing Azure SQL Database resources. You can use these APIs to programmatically create, configure, and manage your SQL databases, servers, and related resources.

Overview

The Azure SQL Database Management REST API allows you to interact with Azure SQL Database resources using standard HTTP requests. This API is part of the Azure Resource Manager (ARM) API, enabling you to manage resources as part of your Azure infrastructure.

Authentication

All REST API requests must be authenticated using Azure Active Directory (Azure AD). You'll need to obtain an access token and include it in the Authorization header of your requests.

Authorization: Bearer <Your-Access-Token>

Common Operations

Create Database

Creates a new Azure SQL Database.

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

Request Body (Example):

{
    "location": "West US",
    "properties": {
        "collation": "SQL_Latin1_General_CP1_CI_AS",
        "maxSizeBytes": 536870912000,
        "requestedServiceObjectiveName": "Basic",
        "edition": "Basic"
    }
}

Parameters:

Name Type Description Required
subscriptionId string The ID of the subscription. Yes
resourceGroupName string The name of the resource group. Yes
serverName string The name of the SQL server. Yes
databaseName string The name of the database to create. Yes

Response (Success - 201 Created):

{
    "id": "/subscriptions/.../resourceGroups/.../providers/Microsoft.Sql/servers/.../databases/...",
    "name": "...",
    "type": "Microsoft.Sql/servers/databases",
    "location": "West US",
    "properties": {
        "collation": "SQL_Latin1_General_CP1_CI_AS",
        "maxSizeBytes": 536870912000,
        "status": "Online",
        "creationDate": "2023-10-27T10:00:00Z",
        "earliestRestoreDate": "2023-10-27T10:00:00Z",
        "requestedServiceObjectiveName": "Basic",
        "edition": "Basic"
    }
}

Get Database

Retrieves a specific Azure SQL Database.

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

Parameters:

Name Type Description Required
subscriptionId string The ID of the subscription. Yes
resourceGroupName string The name of the resource group. Yes
serverName string The name of the SQL server. Yes
databaseName string The name of the database to retrieve. Yes

Response (Success - 200 OK):

{
    "id": "/subscriptions/.../resourceGroups/.../providers/Microsoft.Sql/servers/.../databases/...",
    "name": "...",
    "type": "Microsoft.Sql/servers/databases",
    "location": "West US",
    "properties": {
        "collation": "SQL_Latin1_General_CP1_CI_AS",
        "maxSizeBytes": 536870912000,
        "status": "Online",
        "creationDate": "2023-10-27T10:00:00Z",
        "earliestRestoreDate": "2023-10-27T10:00:00Z",
        "requestedServiceObjectiveName": "Basic",
        "edition": "Basic"
    }
}

List Databases

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

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

Parameters:

Name Type Description Required
subscriptionId string The ID of the subscription. Yes
resourceGroupName string The name of the resource group. Yes
serverName string The name of the SQL server. Yes

Response (Success - 200 OK):

{
    "value": [
        {
            "id": "/subscriptions/.../resourceGroups/.../providers/Microsoft.Sql/servers/.../databases/db1",
            "name": "db1",
            "type": "Microsoft.Sql/servers/databases",
            "location": "West US",
            "properties": { ... }
        },
        {
            "id": "/subscriptions/.../resourceGroups/.../providers/Microsoft.Sql/servers/.../databases/db2",
            "name": "db2",
            "type": "Microsoft.Sql/servers/databases",
            "location": "West US",
            "properties": { ... }
        }
    ]
}

Delete Database

Deletes a specific Azure SQL Database.

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

Parameters:

Name Type Description Required
subscriptionId string The ID of the subscription. Yes
resourceGroupName string The name of the resource group. Yes
serverName string The name of the SQL server. Yes
databaseName string The name of the database to delete. Yes

Response (Success - 200 OK, 204 No Content):

A successful deletion will typically return a 200 OK with an operation status or a 204 No Content if the operation is immediate.

Other Management Operations

Note: For performing operations directly on database data (CRUD operations, querying), refer to the Data Plane REST API.