Export Database (classic)

 

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

Exports an Azure SQL Database to Blob storage as a BACPAC file.

Important

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.

Request

The Export Database request must be specified as follows:

  • Replace {subscriptionId} with your subscription ID.

  • Replace {serverName} with the name of the source server.

Method Request URI HTTP Version
POST https://management.core.windows.net:8443/{subscriptionId}/services/sqlservers/servers/{serverName}/DacOperations/Export HTTP/1.1

URI Parameters

None.

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.
x-ms-client-request-id Optional. Provides a client-generated, opaque value with a 1 KB character limit. Using this header is highly recommended for correlating client-side activities with requests received by the server.

Request Body

The format of the request body is as follows.

<ExportInput xmlns="http://schemas.datacontract.org/2004/07/Microsoft.SqlServer.Management.Dac.ServiceTypes" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">  
  <BlobCredentials i:type="BlobStorageAccessKeyCredentials">  
    <Uri>{uriBase}</Uri>  
    <StorageAccessKey>+Ka1LjBc36Pa62WOCJ9zXJjlN5qU6YU3B2JYTgSfw8xiQKlrBoOmAEcdJSO3/YPA5JcJAmMSWCyQB7w1D96k8A==</StorageAccessKey>  
  </BlobCredentials>  
  <ConnectionInfo>  
    <DatabaseName>{dbName}</DatabaseName>  
    <Password>{myPassword}</Password>  
    <ServerName>{serverName}.database.windows.net</ServerName>  
    <UserName>{mylogin}</UserName>  
  </ConnectionInfo>  
</ExportInput>  

The following table describes the elements of the request body:

Element Name Description
BlobCredentials The required information to connect to blob storage to save the BACPAC.
BlobCredentials:URI The URI of the BACPAC to export.
BlobCredentials:StorageAccessKey The primary access key for accessing storage.
ConnectionInfo The required information for connecting to the Azure SQL Database.
ConnectionInfo:DatabaseName The name of the database to export.
ConnectionInfo:Password The password for connecting to the Azure SQL Database Server that contains the database.
ConnectionInfo:ServerName The name of the server that the database will be exported from. This must be the fully qualified domain name of the server.
ConnectionInfo:UserName The user name to connect to the Azure SQL Database Server.

Response

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

Status Code

Successful export of the database returns a status of 'OK'.

Response Headers

The response for this operation includes the following headers.

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

<guid xmlns=”http://schemas.microsoft.com/2003/10/Serialization/”>00000000-0000-0000-0001-000000000001</guid>  

The following table describes the elements in the response body:

Element Name Description
guid The RequestID for this operation. Use the request id to query the service for the status of the operation.

See Also

Common REST API Error Codes
Azure SQL Database
Operations for Azure SQL Databases
Azure SQL Database Cmdlets