Databases - List By Server

Gets a list of databases.

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases?api-version=2021-11-01
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases?$skipToken={$skipToken}&api-version=2021-11-01

URI Parameters

Name In Required Type Description
resourceGroupName
path True

string

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.

serverName
path True

string

The name of the server.

subscriptionId
path True

string

The subscription ID that identifies an Azure subscription.

api-version
query True

string

The API version to use for the request.

$skipToken
query

string

Responses

Name Type Description
200 OK

DatabaseListResult

Successfully retrieved the list of databases.

Other Status Codes

*** Error Responses: ***

  • 404 SubscriptionDoesNotHaveServer - The requested server was not found

  • 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

Examples

Gets a list of databases.

Sample request

GET https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases?api-version=2021-11-01

Sample response

{
  "value": [
    {
      "sku": {
        "name": "BC_Gen4",
        "tier": "BusinessCritical",
        "capacity": 2
      },
      "kind": "v12.0,user,vcore",
      "properties": {
        "collation": "SQL_Latin1_General_CP1_CI_AS",
        "maxSizeBytes": 268435456000,
        "status": "Online",
        "databaseId": "6c764297-577b-470f-9af4-96d3d41e2ba3",
        "creationDate": "2017-06-07T04:41:33.937Z",
        "currentServiceObjectiveName": "BC_Gen4_2",
        "requestedServiceObjectiveName": "BC_Gen4_2",
        "defaultSecondaryLocation": "North Europe",
        "catalogCollation": "SQL_Latin1_General_CP1_CI_AS",
        "licenseType": "LicenseIncluded",
        "maxLogSizeBytes": 104857600,
        "isInfraEncryptionEnabled": false,
        "zoneRedundant": false,
        "readScale": "Enabled",
        "earliestRestoreDate": "2017-06-07T04:51:33.937Z",
        "currentSku": {
          "name": "BC_Gen4",
          "tier": "BusinessCritical",
          "capacity": 2
        },
        "currentBackupStorageRedundancy": "Zone",
        "requestedBackupStorageRedundancy": "Zone",
        "isLedgerOn": false
      },
      "location": "southeastasia",
      "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb",
      "name": "testdb",
      "type": "Microsoft.Sql/servers/databases"
    },
    {
      "sku": {
        "name": "System0",
        "tier": "System",
        "capacity": 0
      },
      "kind": "v12.0,system",
      "properties": {
        "collation": "SQL_Latin1_General_CP1_CI_AS",
        "maxSizeBytes": 32212254720,
        "status": "Online",
        "databaseId": "e6be351f-2cc9-4604-9e52-b0b28b2710b0",
        "creationDate": "2017-06-07T04:23:42.537Z",
        "currentServiceObjectiveName": "System0",
        "requestedServiceObjectiveName": "System0",
        "defaultSecondaryLocation": "North Europe",
        "catalogCollation": "SQL_Latin1_General_CP1_CI_AS",
        "isInfraEncryptionEnabled": false,
        "zoneRedundant": false,
        "readScale": "Disabled",
        "currentSku": {
          "name": "System0",
          "tier": "System",
          "capacity": 0
        },
        "currentBackupStorageRedundancy": "Local",
        "requestedBackupStorageRedundancy": "Local",
        "isLedgerOn": false
      },
      "location": "southeastasia",
      "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/master",
      "name": "master",
      "type": "Microsoft.Sql/servers/databases"
    }
  ]
}

Definitions

Name Description
BackupStorageRedundancy

The storage account type used to store backups for this database.

CatalogCollationType

Collation of the metadata catalog.

CreateMode

Specifies the mode of database creation.

Default: regular database creation.

Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database.

Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database.

PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified.

Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore.

Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time.

RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID.

Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition.

Database

A database resource.

DatabaseIdentity

Azure Active Directory identity configuration for a resource.

DatabaseIdentityType

The identity type

DatabaseLicenseType

The license type to apply for this database. LicenseIncluded if you need a license, or BasePrice if you have a license and are eligible for the Azure Hybrid Benefit.

DatabaseListResult

A list of databases.

DatabaseReadScale

The state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Not applicable to a Hyperscale database within an elastic pool.

DatabaseStatus

The status of the database.

DatabaseUserIdentity

Azure Active Directory identity configuration for a resource.

SampleName

The name of the sample schema to apply when creating this database.

SecondaryType

The secondary type of the database if it is a secondary. Valid values are Geo and Named.

Sku

An ARM Resource SKU.

BackupStorageRedundancy

The storage account type used to store backups for this database.

Name Type Description
Geo

string

GeoZone

string

Local

string

Zone

string

CatalogCollationType

Collation of the metadata catalog.

Name Type Description
DATABASE_DEFAULT

string

SQL_Latin1_General_CP1_CI_AS

string

CreateMode

Specifies the mode of database creation.

Default: regular database creation.

Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database.

Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database.

PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified.

Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore.

Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time.

RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID.

Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition.

Name Type Description
Copy

string

Default

string

OnlineSecondary

string

PointInTimeRestore

string

Recovery

string

Restore

string

RestoreExternalBackup

string

RestoreExternalBackupSecondary

string

RestoreLongTermRetentionBackup

string

Secondary

string

Database

A database resource.

Name Type Description
id

string

Resource ID.

identity

DatabaseIdentity

The Azure Active Directory identity of the database.

kind

string

Kind of database. This is metadata used for the Azure portal experience.

location

string

Resource location.

managedBy

string

Resource that manages the database.

name

string

Resource name.

properties.autoPauseDelay

integer

Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled

properties.catalogCollation

CatalogCollationType

Collation of the metadata catalog.

properties.collation

string

The collation of the database.

properties.createMode

CreateMode

Specifies the mode of database creation.

Default: regular database creation.

Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database.

Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database.

PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified.

Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore.

Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time.

RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID.

Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition.

properties.creationDate

string

The creation date of the database (ISO8601 format).

properties.currentBackupStorageRedundancy

BackupStorageRedundancy

The storage account type used to store backups for this database.

properties.currentServiceObjectiveName

string

The current service level objective name of the database.

properties.currentSku

Sku

The name and tier of the SKU.

properties.databaseId

string

The ID of the database.

properties.defaultSecondaryLocation

string

The default secondary region for this database.

properties.earliestRestoreDate

string

This records the earliest start date and time that restore is available for this database (ISO8601 format).

properties.elasticPoolId

string

The resource identifier of the elastic pool containing this database.

properties.failoverGroupId

string

Failover Group resource identifier that this database belongs to.

properties.federatedClientId

string

The Client id used for cross tenant per database CMK scenario

properties.highAvailabilityReplicaCount

integer

The number of secondary replicas associated with the database that are used to provide high availability. Not applicable to a Hyperscale database within an elastic pool.

properties.isInfraEncryptionEnabled

boolean

Infra encryption is enabled for this database.

properties.isLedgerOn

boolean

Whether or not this database is a ledger database, which means all tables in the database are ledger tables. Note: the value of this property cannot be changed after the database has been created.

properties.licenseType

DatabaseLicenseType

The license type to apply for this database. LicenseIncluded if you need a license, or BasePrice if you have a license and are eligible for the Azure Hybrid Benefit.

properties.longTermRetentionBackupResourceId

string

The resource identifier of the long term retention backup associated with create operation of this database.

properties.maintenanceConfigurationId

string

Maintenance configuration id assigned to the database. This configuration defines the period when the maintenance updates will occur.

properties.maxLogSizeBytes

integer

The max log size for this database.

properties.maxSizeBytes

integer

The max size of the database expressed in bytes.

properties.minCapacity

number

Minimal capacity that database will always have allocated, if not paused

properties.pausedDate

string

The date when database was paused by user configuration or action(ISO8601 format). Null if the database is ready.

properties.readScale

DatabaseReadScale

The state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Not applicable to a Hyperscale database within an elastic pool.

properties.recoverableDatabaseId

string

The resource identifier of the recoverable database associated with create operation of this database.

properties.recoveryServicesRecoveryPointId

string

The resource identifier of the recovery point associated with create operation of this database.

properties.requestedBackupStorageRedundancy

BackupStorageRedundancy

The storage account type to be used to store backups for this database.

properties.requestedServiceObjectiveName

string

The requested service level objective name of the database.

properties.restorableDroppedDatabaseId

string

The resource identifier of the restorable dropped database associated with create operation of this database.

properties.restorePointInTime

string

Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database.

properties.resumedDate

string

The date when database was resumed by user action or database login (ISO8601 format). Null if the database is paused.

properties.sampleName

SampleName

The name of the sample schema to apply when creating this database.

properties.secondaryType

SecondaryType

The secondary type of the database if it is a secondary. Valid values are Geo and Named.

properties.sourceDatabaseDeletionDate

string

Specifies the time that the database was deleted.

properties.sourceDatabaseId

string

The resource identifier of the source database associated with create operation of this database.

properties.sourceResourceId

string

The resource identifier of the source associated with the create operation of this database.

This property is only supported for DataWarehouse edition and allows to restore across subscriptions.

When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, restorableDroppedDatabaseId and sourceDatabaseDeletionDate must not be specified and CreateMode must be PointInTimeRestore, Restore or Recover.

When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of the existing database or existing sql pool, and restorePointInTime must be specified.

When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or restorable dropped sql pool.

When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or recoverable sql pool.

When source subscription belongs to a different tenant than target subscription, “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant. For more details about “x-ms-authorization-auxiliary” header see https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant

properties.status

DatabaseStatus

The status of the database.

properties.zoneRedundant

boolean

Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones.

sku

Sku

The database SKU.

The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the Capabilities_ListByLocation REST API or one of the following commands:

az sql db list-editions -l <location> -o table
Get-AzSqlServerServiceObjective -Location <location>
tags

object

Resource tags.

type

string

Resource type.

DatabaseIdentity

Azure Active Directory identity configuration for a resource.

Name Type Description
tenantId

string

The Azure Active Directory tenant id.

type

DatabaseIdentityType

The identity type

userAssignedIdentities

<string,  DatabaseUserIdentity>

The resource ids of the user assigned identities to use

DatabaseIdentityType

The identity type

Name Type Description
None

string

UserAssigned

string

DatabaseLicenseType

The license type to apply for this database. LicenseIncluded if you need a license, or BasePrice if you have a license and are eligible for the Azure Hybrid Benefit.

Name Type Description
BasePrice

string

LicenseIncluded

string

DatabaseListResult

A list of databases.

Name Type Description
nextLink

string

Link to retrieve next page of results.

value

Database[]

Array of results.

DatabaseReadScale

The state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Not applicable to a Hyperscale database within an elastic pool.

Name Type Description
Disabled

string

Enabled

string

DatabaseStatus

The status of the database.

Name Type Description
AutoClosed

string

Copying

string

Creating

string

Disabled

string

EmergencyMode

string

Inaccessible

string

Offline

string

OfflineChangingDwPerformanceTiers

string

OfflineSecondary

string

Online

string

OnlineChangingDwPerformanceTiers

string

Paused

string

Pausing

string

Recovering

string

RecoveryPending

string

Restoring

string

Resuming

string

Scaling

string

Shutdown

string

Standby

string

Starting

string

Stopped

string

Stopping

string

Suspect

string

DatabaseUserIdentity

Azure Active Directory identity configuration for a resource.

Name Type Description
clientId

string

The Azure Active Directory client id.

principalId

string

The Azure Active Directory principal id.

SampleName

The name of the sample schema to apply when creating this database.

Name Type Description
AdventureWorksLT

string

WideWorldImportersFull

string

WideWorldImportersStd

string

SecondaryType

The secondary type of the database if it is a secondary. Valid values are Geo and Named.

Name Type Description
Geo

string

Named

string

Sku

An ARM Resource SKU.

Name Type Description
capacity

integer

Capacity of the particular SKU.

family

string

If the service has different generations of hardware, for the same SKU, then that can be captured here.

name

string

The name of the SKU, typically, a letter + Number code, e.g. P3.

size

string

Size of the particular SKU

tier

string

The tier or edition of the particular SKU, e.g. Basic, Premium.