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=2017-10-01-preview

URI Parameters

Name In Required Type Description
subscriptionId
path True
  • string

The subscription ID that identifies an Azure subscription.

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.

api-version
query True
  • string

The API version to use for the request.

Responses

Name Type Description
200 OK

Successfully retrieved the list of databases.

Other Status Codes

*** Error Responses: ***

  • 404 SubscriptionDoesNotHaveServer - The requested server was not found

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=2017-10-01-preview

Sample Response

{
  "value": [
    {
      "sku": {
        "name": "BC_Gen4_2",
        "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",
        "defaultSecondaryLocation": "North Europe",
        "catalogCollation": "SQL_Latin1_General_CP1_CI_AS",
        "licenseType": "LicenseIncluded",
        "maxLogSizeBytes": 104857600
      },
      "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"
      },
      "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",
        "defaultSecondaryLocation": "North Europe",
        "catalogCollation": "SQL_Latin1_General_CP1_CI_AS"
      },
      "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

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.

DatabaseLicenseType

The license type to apply for this database.

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.

DatabaseStatus

The status of the database.

SampleName

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

Sku

The resource model definition representing SKU

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.

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

Collation of the metadata catalog.

properties.collation
  • string

The collation of the database.

properties.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.currentServiceObjectiveName
  • string

The current service level objective name of the database.

properties.currentSku

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

The license type to apply for this database.

properties.longTermRetentionBackupResourceId
  • string

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

properties.maxLogSizeBytes
  • integer

The max log size for this database.

properties.maxSizeBytes
  • integer

The max size of the database expressed in bytes.

properties.readScale

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.

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

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

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

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

The name and tier of the SKU.

tags
  • object

Resource tags.

type
  • string

Resource type.

DatabaseLicenseType

The license type to apply for this database.

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

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.

Name Type Description
Disabled
  • string
Enabled
  • string

DatabaseStatus

The status of the database.

Name Type Description
AutoClosed
  • string
Copying
  • string
Creating
  • string
EmergencyMode
  • string
Inaccessible
  • string
Offline
  • string
OfflineSecondary
  • string
Online
  • string
Paused
  • string
Pausing
  • string
Recovering
  • string
RecoveryPending
  • string
Restoring
  • string
Resuming
  • string
Scaling
  • string
Shutdown
  • string
Standby
  • string
Suspect
  • string

SampleName

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

Name Type Description
AdventureWorksLT
  • string
WideWorldImportersFull
  • string
WideWorldImportersStd
  • string

Sku

The resource model definition representing SKU

Name Type Description
capacity
  • integer

If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted.

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. Ex - P3. It is typically a letter+number code

size
  • string

The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code.

tier
  • string

This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT.