Freigeben über


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=2023-08-01
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases?$skipToken={$skipToken}&api-version=2023-08-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

ErrorResponse

*** Error Responses: ***

  • 400 ManagedInstanceStoppingOrStopped - Conflicting operation submitted while instance is in stopping/stopped state

  • 400 ManagedInstanceStarting - Conflicting operation submitted while instance is in starting state

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

  • 404 SubscriptionDoesNotHaveServer - The requested server was not found

Examples

Gets a list of databases configured with enclave type.
Gets a list of databases.

Gets a list of databases configured with enclave type.

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=2023-08-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,
        "preferredEnclaveType": "Default"
      },
      "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,
        "preferredEnclaveType": "VBS"
      },
      "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"
    }
  ]
}

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=2023-08-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
AlwaysEncryptedEnclaveType

Type of enclave requested on the database i.e. Default or VBS enclaves.

AvailabilityZoneType

Specifies the availability zone the database is pinned to.

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

DatabaseKey

Database level key used for encryption at rest.

DatabaseKeyType

The database key type. Only supported value is 'AzureKeyVault'.

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.

ErrorAdditionalInfo

The resource management error additional info.

ErrorDetail

The error detail.

ErrorResponse

Error response

FreeLimitExhaustionBehavior

Specifies the behavior when monthly free limits are exhausted for the free database.

AutoPause: The database will be auto paused upon exhaustion of free limits for remainder of the month.

BillForUsage: The database will continue to be online upon exhaustion of free limits and any overage will be billed.

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, Named and Standby.

Sku

An ARM Resource SKU.

AlwaysEncryptedEnclaveType

Type of enclave requested on the database i.e. Default or VBS enclaves.

Value Description
Default
VBS

AvailabilityZoneType

Specifies the availability zone the database is pinned to.

Value Description
1
2
3
NoPreference

BackupStorageRedundancy

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

Value Description
Geo
GeoZone
Local
Zone

CatalogCollationType

Collation of the metadata catalog.

Value Description
DATABASE_DEFAULT
SQL_Latin1_General_CP1_CI_AS

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.

Value Description
Copy
Default
OnlineSecondary
PointInTimeRestore
Recovery
Restore
RestoreExternalBackup
RestoreExternalBackupSecondary
RestoreLongTermRetentionBackup
Secondary

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 (int32)

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

properties.availabilityZone

AvailabilityZoneType

Specifies the availability zone the database is pinned to.

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 (date-time)

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 (uuid)

The ID of the database.

properties.defaultSecondaryLocation

string

The default secondary region for this database.

properties.earliestRestoreDate

string (date-time)

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

properties.elasticPoolId

string (arm-id)

The resource identifier of the elastic pool containing this database.

properties.encryptionProtector

string

The azure key vault URI of the database if it's configured with per Database Customer Managed Keys.

properties.encryptionProtectorAutoRotation

boolean

The flag to enable or disable auto rotation of database encryption protector AKV key.

properties.failoverGroupId

string

Failover Group resource identifier that this database belongs to.

properties.federatedClientId

string (uuid)

The Client id used for cross tenant per database CMK scenario

properties.freeLimitExhaustionBehavior

FreeLimitExhaustionBehavior

Specifies the behavior when monthly free limits are exhausted for the free database.

AutoPause: The database will be auto paused upon exhaustion of free limits for remainder of the month.

BillForUsage: The database will continue to be online upon exhaustion of free limits and any overage will be billed.

properties.highAvailabilityReplicaCount

integer (int32)

The number of secondary replicas associated with the Business Critical, Premium, or Hyperscale edition 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.keys

<string,  DatabaseKey>

The resource ids of the user assigned identities to use

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 (arm-id)

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.manualCutover

boolean

Whether or not customer controlled manual cutover needs to be done during Update Database operation to Hyperscale tier.

This property is only applicable when scaling database from Business Critical/General Purpose/Premium/Standard tier to Hyperscale tier.

When manualCutover is specified, the scaling operation will wait for user input to trigger cutover to Hyperscale database.

To trigger cutover, please provide 'performCutover' parameter when the Scaling operation is in Waiting state.

properties.maxLogSizeBytes

integer (int64)

The max log size for this database.

properties.maxSizeBytes

integer (int64)

The max size of the database expressed in bytes.

properties.minCapacity

number (double)

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

properties.pausedDate

string (date-time)

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

properties.performCutover

boolean

To trigger customer controlled manual cutover during the wait state while Scaling operation is in progress.

This property parameter is only applicable for scaling operations that are initiated along with 'manualCutover' parameter.

This property is only applicable when scaling database from Business Critical/General Purpose/Premium/Standard tier to Hyperscale tier is already in progress.

When performCutover is specified, the scaling operation will trigger cutover and perform role-change to Hyperscale database.

properties.preferredEnclaveType

AlwaysEncryptedEnclaveType

Type of enclave requested on the database i.e. Default or VBS enclaves.

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 (arm-id)

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

properties.recoveryServicesRecoveryPointId

string (arm-id)

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 (arm-id)

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

properties.restorePointInTime

string (date-time)

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

properties.resumedDate

string (date-time)

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, Named and Standby.

properties.sourceDatabaseDeletionDate

string (date-time)

Specifies the time that the database was deleted.

properties.sourceDatabaseId

string (arm-id)

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

properties.sourceResourceId

string (arm-id)

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.useFreeLimit

boolean

Whether or not the database uses free monthly limits. Allowed on one database in a subscription.

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 (uuid)

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

Value Description
None
UserAssigned

DatabaseKey

Database level key used for encryption at rest.

Name Type Description
creationDate

string (date-time)

The database key creation date.

subregion

string

Subregion of the server key.

thumbprint

string

Thumbprint of the database key.

type

DatabaseKeyType

The database key type. Only supported value is 'AzureKeyVault'.

DatabaseKeyType

The database key type. Only supported value is 'AzureKeyVault'.

Value Description
AzureKeyVault

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.

Value Description
BasePrice
LicenseIncluded

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.

Value Description
Disabled
Enabled

DatabaseStatus

The status of the database.

Value Description
AutoClosed
Copying
Creating
Disabled
EmergencyMode
Inaccessible
Offline
OfflineChangingDwPerformanceTiers
OfflineSecondary
Online
OnlineChangingDwPerformanceTiers
Paused
Pausing
Recovering
RecoveryPending
Restoring
Resuming
Scaling
Shutdown
Standby
Starting
Stopped
Stopping
Suspect

DatabaseUserIdentity

Azure Active Directory identity configuration for a resource.

Name Type Description
clientId

string (uuid)

The Azure Active Directory client id.

principalId

string (uuid)

The Azure Active Directory principal id.

ErrorAdditionalInfo

The resource management error additional info.

Name Type Description
info

object

The additional info.

type

string

The additional info type.

ErrorDetail

The error detail.

Name Type Description
additionalInfo

ErrorAdditionalInfo[]

The error additional info.

code

string

The error code.

details

ErrorDetail[]

The error details.

message

string

The error message.

target

string

The error target.

ErrorResponse

Error response

Name Type Description
error

ErrorDetail

The error object.

FreeLimitExhaustionBehavior

Specifies the behavior when monthly free limits are exhausted for the free database.

AutoPause: The database will be auto paused upon exhaustion of free limits for remainder of the month.

BillForUsage: The database will continue to be online upon exhaustion of free limits and any overage will be billed.

Value Description
AutoPause
BillOverUsage

SampleName

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

Value Description
AdventureWorksLT
WideWorldImportersFull
WideWorldImportersStd

SecondaryType

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

Value Description
Geo
Named
Standby

Sku

An ARM Resource SKU.

Name Type Description
capacity

integer (int32)

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.