Symptoms:
Creating or importing database failed due to violation of policy “Azure SQL DB should avoid using GRS backup”
When creating database, you should specify the backup storage to be used, while the default is GRS (Globally redundant storage) and it violates the policy.
While importing database either using Azure Portal, RestAPI, SSMS or SQLPackage you cannot specify the backup storage as it’s not implemented yet.
This cause the import operation to fail with the following exception:
Configuring backup storage account type to 'Standard_RAGRS' failed during Database create or update.
Solution:
You can either
Examples:
Option (A)
CREATE DATABASE ImportedDB WITH BACKUP_STORAGE_REDUNDANCY = 'ZONE';
Option (B)
You may use ARM template to create database with specific backup storage and import the database at the same time.
This can be done with ARM template by using the extension named “import”
Add the following Json to your ARM template to your database resource section and make sure you provide the values for the parameters or set the values hardcoded in the template
The needed information is:
Storage Account key to access the bacpac file
Bacpac file URL
Azure SQL Server Admin Username
Azure SQL Server Admin Password
"resources": [
{
"type": "extensions",
"apiVersion": "2014-04-01",
"name": "Import",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers/databases', parameters('ServerName'), parameters('databaseName'))]"
],
"properties": {
"storageKeyType": "StorageAccessKey",
"storageKey": "[parameters('storageAccountKey')]",
"storageUri": "[parameters('bacpacUrl')]",
"administratorLogin": "[parameters('adminUser')]",
"administratorLoginPassword": "[parameters('adminPassword')]",
"operationMode": "Import"
}
}
]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.