Databases - Import Export - 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
subscriptionId
path True
  • string

The subscription ID that identifies an Azure subscription.

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.

api-version
query True
  • string

The API version to use for the request.

Request Body

Name Required Type Description
administratorLogin True
  • string

The name of the SQL administrator.

administratorLoginPassword True
  • string

The password of the SQL administrator.

authenticationType

The authentication type.

databaseName True
  • string

The name of the database to import.

edition True

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 True
  • string

The maximum size for the newly imported database.

serviceObjectiveName True

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

storageKey True
  • string

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

storageKeyType True

The type of the storage key to use.

storageUri True
  • string

The storage uri to use.

Responses

Name Type Description
200 OK

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

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": "Un53cuRE!"
}

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

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

Import database parameters.

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.

Name Type Description
ADPassword
  • string
SQL
  • string

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>
Name Type Description
Basic
  • string
Business
  • string
BusinessCritical
  • string
DataWarehouse
  • string
Free
  • string
GeneralPurpose
  • string
Hyperscale
  • string
Premium
  • string
PremiumRS
  • string
Standard
  • string
Stretch
  • string
System
  • string
System2
  • string
Web
  • 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.

ImportRequest

Import database parameters.

Name Type Description
administratorLogin
  • string

The name of the SQL administrator.

administratorLoginPassword
  • string

The password of the SQL administrator.

authenticationType

The authentication type.

databaseName
  • string

The name of the database to import.

edition

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

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

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.

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

StorageKeyType

The type of the storage key to use.

Name Type Description
SharedAccessKey
  • string
StorageAccessKey
  • string