Azure SQL Database Documentation

Databases (Reference)

The Databases REST API lets you manage Azure SQL Database resources – create, list, update, and delete databases within a logical server.

All calls are made to the https://management.azure.com endpoint and require a valid Azure AD token.

Database properties

Property Type Required Description
name string Yes The name of the database.
location string Yes Azure region (e.g., westus2).
properties.collation string No Collation for the database (default SQL_Latin1_General_CP1_CI_AS).
properties.maxSizeBytes string No Maximum size in bytes (e.g., 1073741824 for 1 GB).
sku.name string Yes Performance tier e.g., Basic, Standard, Premium.
sku.tier string No Corresponding tier (same as name for Azure SQL).
sku.capacity int No DTU or vCore count depending on SKU model.
status string Read‑only Current provisioning status (e.g., Online).

Common operations

List databases

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{rgName}/providers/Microsoft.Sql/servers/{serverName}/databases?api-version=2023-02-01-preview

Create or update a database

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{rgName}/providers/Microsoft.Sql/servers/{serverName}/databases/{dbName}?api-version=2023-02-01-preview
{
    "location": "westus2",
    "properties": {
        "collation": "SQL_Latin1_General_CP1_CI_AS",
        "maxSizeBytes": "1073741824"
    },
    "sku": {
        "name": "Basic",
        "tier": "Basic",
        "capacity": 5
    }
}

Delete a database

DELETE https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{rgName}/providers/Microsoft.Sql/servers/{serverName}/databases/{dbName}?api-version=2023-02-01-preview

Code examples

Below are snippets for the most popular SDKs.

Azure CLI

# Create a database
az sql db create --resource-group MyResourceGroup --server myserver --name mydb --service-objective Basic

# List databases
az sql db list --resource-group MyResourceGroup --server myserver -o table

PowerShell

# Create a database
New-AzSqlDatabase -ResourceGroupName "MyResourceGroup" -ServerName "myserver" -DatabaseName "mydb" -Edition "Basic"

# Delete a database
Remove-AzSqlDatabase -ResourceGroupName "MyResourceGroup" -ServerName "myserver" -DatabaseName "mydb"

Python (azure-mgmt-sql)

from azure.identity import DefaultAzureCredential
from azure.mgmt.sql import SqlManagementClient

credential = DefaultAzureCredential()
client = SqlManagementClient(credential, SUBSCRIPTION_ID)

# Create database
client.databases.create_or_update(
    RESOURCE_GROUP,
    SERVER_NAME,
    DB_NAME,
    {
        "location": "westus2",
        "sku": {"name": "Basic"},
        "properties": {"maxSizeBytes": "1073741824"}
    }
)