Get Database (classic)


THIS TOPIC APPLIES TO: noSQL Server yesAzure SQL DatabaseyesAzure SQL Data Warehouse noParallel Data Warehouse

Gets the details for an Azure SQL Database.


The recommended REST commands to work with SQL Database are the Resource Manager based Azure SQL Database REST API. While there is no change to SQL Database, be aware that the classic deployment model command in this article is scheduled for deprecation on December 1, 2019. For a table providing links to the specific new commands you should use, see Operations for Azure SQL Databases.


The Get Database request must be specified as follows:

  • Replace {subscriptionId} with your subscription ID.

  • Replace {serverName} with the name of the server containing the database whose details you want.

  • Replace {databaseName} with the name of the database you want to inspect.

Method Request URI HTTP Version
GET{subscriptionId}/services/sqlservers/servers/{serverName}/databases/{databaseName} HTTP/1.1

URI Parameters


Request Headers

The following table describes the required and optional request headers:

Request Header Description
x-ms-version Required. Specifies the version of the operation to use for this request. This header should be set to 2012-03-01.

Request Body



The response includes an HTTP status code, a set of response headers, and a response body.

Status Code

Response Headers

The response for this operation includes the following headers. The response may also include additional standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.

Response Header Description
x-ms-request-id A value that uniquely identifies a request made against the database management service. This request id is used for request tracking. If a failure occurs that requires the user to contact Microsoft Support, the request id should be provided to Microsoft to assist in tracking and resolving the failure for the request.

Response Body

The following is an example response body:

<ServiceResource xmlns="" xmlns:i="">  
  <SizeMB i:nil="true"/>  
  <ServiceObjectiveAssignmentErrorDescription i:nil="true"/>  
  <RecoveryPeriodStartDate i:nil="true"/>  

The following table describes the elements of the response body:

Name The name of the database to retrieve.
Type The type of the resource. A database will be Microsoft.SqlAzure.Database.
State The state of the service resource.
SelfLink The URI for this service resource.
ParentLink The URI for the parent service resource.
Id The database ID. Each database in a server has a unique ID.
Edition The current edition of the database. If the edition was changed during an update, this will be the old value until any pending Service Level Objective (SLO) assignments are completed. For edition changes that don’t require a SLO change, this will be the new edition.
MaxSizeGB The maximum size of the database in gigabytes.
CollationName The name of the database collation.
CreationDate The date and time this database was created.
IsFederationRoot Specifies if this database is the federation root.
IsSystemObject Specifies if this database is a system object. Master database is an example of a system object.
SizeMb The currently used size of the database in megabytes.
MaxSizeBytes The maximum size of the database expressed in bytes.
ServiceObjectiveId The currently assigned and active service objective ID. If a SLO change is in progress or pending, this will be the SLO before the update was applied.

To know which GUID to use in ServiceObjectiveId, see List Service Level Objectives (classic) find the ID of the service that you want, and locate the GUID for that service.
AssignedServiceObjectiveId The currently assigned service objective ID. If a SLO change is in progress or pending this will be the new SLO that is assigned to the database.
ServiceObjectiveAssignmentState An integer representing the current state of the service objective assignment operation. 1 is complete and 0 is pending.
ServiceObjectiveAssignementStateDescription The current state of the service objective assignment. Pending means the database is currently transitioning from one Service Objective to another. Complete means that the service objective assignment completed successfully.
ServiceObjectiveAssignmentErrorCode If there was an error assigning the service objective to the database, this will contain the error code.
ServiceObjectiveAssignmentErrorDescription The description for the error, if there was an error.
ServiceObjectiveAssignmentSuccessDate The date and time that the service objective was successfully applied to the database.
RecoveryPeriodStartDate The starting date for when database recovery is available.

See Also

Restore an Azure SQL database using Point in Time Restore with REST API
Common REST API Error Codes
Azure SQL Database
Operations for Azure SQL Databases
Azure SQL Database Cmdlets