Databases - Export

Exports a database to a bacpac.

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export?api-version=2014-04-01

URI Parameters

Name In Required Type Description
databaseName
path True

string

The name of the database to be exported.

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.

Request Body

Name Type Description
parameters

ExportRequest

The required parameters for exporting a database.

Responses

Name Type Description
200 OK

ImportExportResponse

OK

202 Accepted

Accepted

Examples

Export a database into a new bacpac file with SAS key
Export a database into a new bacpac file with storage key

Export a database into a new bacpac file with SAS key

Sample request

POST https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-5961/databases/testdb/export?api-version=2014-04-01

{
  "storageKeyType": "SharedAccessKey",
  "storageKey": "?sr=b&sp=rw&se=2018-01-01T00%3A00%3A00Z&sig=sdfsdfklsdjflSLIFJLSIEJFLKSDJFDd/%2wdfskdjf3%3D&sv=2015-07-08",
  "storageUri": "https://test.blob.core.windows.net/bacpacs/testbacpac.bacpac",
  "administratorLogin": "dummyLogin",
  "administratorLoginPassword": "<administratorLoginPassword>",
  "authenticationType": "SQL"
}

Sample response

{
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-5961/importExportOperationResult/f01d7bfe-7162-44e7-9350-f1c85ce83e4c",
  "name": "f01d7bfe-7162-44e7-9350-f1c85ce83e4c",
  "type": "Microsoft.Sql/servers/importExportOperationResults",
  "properties": {
    "requestId": "f01d7bfe-7162-44e7-9350-f1c85ce83e4c",
    "requestType": "Export",
    "queuedTime": "3/1/2017 12:14:25 AM",
    "lastModifiedTime": "3/1/2017 12:16:33 AM",
    "blobUri": "https://test.blob.core.windows.net/bacpacs/test.bacpac",
    "serverName": "test",
    "databaseName": "testdb",
    "status": "Completed",
    "errorMessage": null
  }
}

Export a database into a new bacpac file with storage key

Sample request

POST https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-5961/databases/testdb/export?api-version=2014-04-01

{
  "storageKeyType": "StorageAccessKey",
  "storageKey": "sdlfkjdsf+sdlfkjsdlkfsjdfLDKFJSDLKFDFKLjsdfksjdflsdkfD2342309432849328479324/3RSD==",
  "storageUri": "https://test.blob.core.windows.net/bacpacs/testbacpac.bacpac",
  "administratorLogin": "dummyLogin",
  "administratorLoginPassword": "<administratorLoginPassword>",
  "authenticationType": "SQL"
}

Sample response

{
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-5961/importExportOperationResult/f01d7bfe-7162-44e7-9350-f1c85ce83e4c",
  "name": "f01d7bfe-7162-44e7-9350-f1c85ce83e4c",
  "type": "Microsoft.Sql/servers/importExportOperationResults",
  "properties": {
    "requestId": "f01d7bfe-7162-44e7-9350-f1c85ce83e4c",
    "requestType": "Export",
    "queuedTime": "3/1/2017 12:14:25 AM",
    "lastModifiedTime": "3/1/2017 12:16:33 AM",
    "blobUri": "https://test.blob.core.windows.net/bacpacs/test.bacpac",
    "serverName": "test",
    "databaseName": "testdb",
    "status": "Completed",
    "errorMessage": null
  }
}

Definitions

Name Description
AuthenticationType

The authentication type.

ExportRequest

The required parameters for exporting a database.

ImportExportResponse

Response for Import/Export Get operation.

StorageKeyType

The type of the storage key to use.

AuthenticationType

The authentication type.

Name Type Description
ADPassword

string

SQL

string

ExportRequest

The required parameters for exporting a database.

Name Type Default value Description
administratorLogin

string

The name of the SQL administrator.

administratorLoginPassword

string

The password of the SQL administrator.

authenticationType

AuthenticationType

SQL

The authentication type.

storageKey

string

The storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?."

storageKeyType

StorageKeyType

The type of the storage key to use.

storageUri

string

The storage uri to use.

ImportExportResponse

Response for Import/Export Get operation.

Name Type Description
id

string

Resource ID.

name

string

Resource name.

properties.blobUri

string

The blob uri.

properties.databaseName

string

The name of the database.

properties.errorMessage

string

The error message returned from the server.

properties.lastModifiedTime

string

The operation status last modified time.

properties.queuedTime

string

The operation queued time.

properties.requestId

string

The request type of the operation.

properties.requestType

string

The request type of the operation.

properties.serverName

string

The name of the server.

properties.status

string

The status message returned from the server.

type

string

Resource type.

StorageKeyType

The type of the storage key to use.

Name Type Description
SharedAccessKey

string

StorageAccessKey

string