Azure / Azure/azure-rest-api-specs

Azure SQL REST endpoint for importing from .bacpac reports failure even though it successfully starts import

Open
#13,825 3 comments 0 reactions 0 assignees View on GitHub
Service Attention SQL
Dominant language
TypeSpec
Stars
3.1k
Forks
6k
Avg merge
2d 22h
Merged PRs (30d)
444

Description

Hey there,

Hopefully this is the right place to report this...

I've attempted this operation through both the Az Powershell library and the pure REST api (using Web actions in ADF). It "fails" with the same message in both circumstances. I haven't tried to do it in a pure code context (Python/JavaScript/C#) yet, but I could probably whip something up.

I have a database delivered to me daily from a vendor through a .bacpac file. I have to create an Azure SQL database from it. My workflow is:

1) Drop the database from the server (this works)
2) Recreate the database as an empty db (this also works)
3) Start an import from the .bacpac file (this... works?)
4) Wait on that import to finish, then scale the database waaaaaay down.

Problem is, when I get to Step 3, it... fails? After about 20 seconds, I get a failure code (both from the REST API and from the Powershell `New-AzSqlDatabaseImport` cmdlet). For a while, I thought it was a configuration issue on my end, but I don't think so -- if I go look at the database, the import is in progress, meaning it _did_ start correctly.

Here's the request body for the REST request:

`POST https://management.azure.com/subscriptions/{subscription}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/import?api-version=2020-11-01-preview')`

```json
{
"administratorLogin": "sql-griffisbi-admin",
"administratorLoginPassword": "password",
"storageKey": "storagekey}",
"storageKeyType": "StorageAccessKey",
"storageUri": "https://mystorageaccount.blob.core.something",
"authenticationType": "Sql"
}
```

And here's the body for the creation request, which currently succeeds (just for context):

```json
{
"location": "centralus",
"sku": {
"name": "GP_S_Gen5",
"Tier": "GeneralPurpose",
"family": "Gen5",
"capacity": "16"
},
"properties": {
"autoPauseDelay": 60,
"collation": "SQL_Latin1_General_CP1_CI_AS",
"minCapacity": 2
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start with the POST import endpoint and request body in the issue, then reproduce the behavior through New-AzSqlDatabaseImport or the REST API and compare the returned failure with the database's import state. The issue does not provide the exact failure code or a specification file; done means determining why a started import is reported as failed and documenting or correcting the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, json, powershell
Domain
api, cloud, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.