Share via


Databases - Import

Imports a bacpac into a new database.

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

URI Parameters

Name In Required Type Description
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

ImportRequest

The required parameters for importing a Bacpac into a database.

Responses

Name Type Description
200 OK

ImportExportResponse

OK

202 Accepted

Accepted

Examples

Import bacpac into new database Max with SAS key
Import bacpac into new database Max with storage key
Import bacpac into new database Min with SAS key
Import bacpac into new database Min with storage key

Import bacpac into new database Max 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/import?api-version=2014-04-01

{
  "databaseName": "TestDbImport",
  "edition": "Basic",
  "serviceObjectiveName": "Basic",
  "maxSizeBytes": "2147483648",
  "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 new database Max 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/import?api-version=2014-04-01

{
  "databaseName": "TestDbImport",
  "edition": "Basic",
  "serviceObjectiveName": "Basic",
  "maxSizeBytes": "2147483648",
  "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 new database Min 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/import?api-version=2014-04-01

{
  "databaseName": "TestDbImport",
  "edition": "Basic",
  "serviceObjectiveName": "Basic",
  "maxSizeBytes": "2147483648",
  "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 new database Min 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/import?api-version=2014-04-01

{
  "databaseName": "TestDbImport",
  "edition": "Basic",
  "serviceObjectiveName": "Basic",
  "maxSizeBytes": "2147483648",
  "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.

DatabaseEdition

The edition for the database being created.

The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the Capabilities_ListByLocation REST API or one of the following commands:

az sql db list-editions -l <location> -o table
Get-AzSqlServerServiceObjective -Location <location>
ImportExportResponse

Response for Import/Export Get operation.

ImportRequest

The required parameters for importing a Bacpac into a database.

ServiceObjectiveName

The name of the service objective to assign to the database.

StorageKeyType

The type of the storage key to use.

AuthenticationType

The authentication type.

Value Description
SQL
ADPassword

DatabaseEdition

The edition for the database being created.

The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the Capabilities_ListByLocation REST API or one of the following commands:

az sql db list-editions -l <location> -o table
Get-AzSqlServerServiceObjective -Location <location>
Value Description
Web
Business
Basic
Standard
Premium
PremiumRS
Free
Stretch
DataWarehouse
System
System2
GeneralPurpose
BusinessCritical
Hyperscale

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 (uuid)

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.

ImportRequest

The required parameters for importing a Bacpac into 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.

databaseName

string

The name of the database to import.

edition

DatabaseEdition

The edition for the database being created.

The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the Capabilities_ListByLocation REST API or one of the following commands:

az sql db list-editions -l <location> -o table
Get-AzSqlServerServiceObjective -Location <location>
maxSizeBytes

string

The maximum size for the newly imported database.

serviceObjectiveName

ServiceObjectiveName

The name of the service objective to assign to the database.

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.

ServiceObjectiveName

The name of the service objective to assign to the database.

Value Description
System
System0
System1
System2
System3
System4
System2L
System3L
System4L
Free
Basic
S0
S1
S2
S3
S4
S6
S7
S9
S12
P1
P2
P3
P4
P6
P11
P15
PRS1
PRS2
PRS4
PRS6
DW100
DW200
DW300
DW400
DW500
DW600
DW1000
DW1200
DW1000c
DW1500
DW1500c
DW2000
DW2000c
DW3000
DW2500c
DW3000c
DW6000
DW5000c
DW6000c
DW7500c
DW10000c
DW15000c
DW30000c
DS100
DS200
DS300
DS400
DS500
DS600
DS1000
DS1200
DS1500
DS2000
ElasticPool

StorageKeyType

The type of the storage key to use.

Value Description
StorageAccessKey
SharedAccessKey