Databases - Create Import Operation

Creates an import operation that imports a bacpac into an existing database. The existing database must be empty.

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

URI Parameters

Name In Required Type Description
databaseName
path True

string

The name of the database to import into

extensionName
path True

ExtensionName

The name of the operation to perform

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

ImportExtensionRequest

The required parameters for importing a Bacpac into a database.

Responses

Name Type Description
201 Created

ImportExportResponse

OK

202 Accepted

Accepted

Examples

Import bacpac into an existing database Max with SAS key
Import bacpac into an existing database Max with storage key
Import bacpac into an existing database Min with SAS key
Import bacpac into an existing database Min with storage key

Import bacpac into an existing database Max with SAS key

Sample request

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

{
  "name": "Import",
  "type": "Microsoft.Sql/servers/databases/extensions",
  "properties": {
    "operationMode": "Import",
    "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": "Import",
    "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
  }
}

Import bacpac into an existing database Max with storage key

Sample request

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

{
  "name": "Import",
  "type": "Microsoft.Sql/servers/databases/extensions",
  "properties": {
    "operationMode": "Import",
    "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": "Import",
    "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
  }
}

Import bacpac into an existing database Min with SAS key

Sample request

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

{
  "properties": {
    "operationMode": "Import",
    "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>"
  }
}

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": "Import",
    "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
  }
}

Import bacpac into an existing database Min with storage key

Sample request

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

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

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": "Import",
    "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.

ExtensionName

The name of the operation to perform

ImportExportResponse

Response for Import/Export Get operation.

ImportExtensionRequest

The required parameters for importing a Bacpac into a database.

ImportOperationMode

The type of import operation being performed. This is always Import.

StorageKeyType

The type of the storage key to use.

AuthenticationType

The authentication type.

Name Type Description
ADPassword

string

SQL

string

ExtensionName

The name of the operation to perform

Name Type Description
import

string

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.

ImportExtensionRequest

The required parameters for importing a Bacpac into a database.

Name Type Default value Description
name

string

The name of the extension.

properties.administratorLogin

string

The name of the SQL administrator.

properties.administratorLoginPassword

string

The password of the SQL administrator.

properties.authenticationType

AuthenticationType

SQL

The authentication type.

properties.operationMode

ImportOperationMode

The type of import operation being performed. This is always Import.

properties.storageKey

string

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

properties.storageKeyType

StorageKeyType

The type of the storage key to use.

properties.storageUri

string

The storage uri to use.

type

string

The type of the extension.

ImportOperationMode

The type of import operation being performed. This is always Import.

Name Type Description
Import

string

StorageKeyType

The type of the storage key to use.

Name Type Description
SharedAccessKey

string

StorageAccessKey

string