Using Azure Resource Manager to Copy Azure SQL Databases

怎甘沉沦 提交于 2019-12-05 18:28:05

The problem is that you are using the wrong value for storageKeyType. You need to use StorageAccessKey.

I use a template like this and that is working correctly, the only difference I see is this key type.

{
  "name": "[concat(variables('sqlServerName'), '/databasename/Import')]",
  "type": "Microsoft.Sql/servers/databases/extensions",
  "apiVersion": "[variables('sqlServerApiVersion')]",
  "tags": {
    "displayName": "Copy Azure SQL DB"
  },
  "properties": {
    "storageKeyType": "StorageAccessKey",
    "storageKey": "[listkeys(variables('storageId'), variables('storageVersion')).key1]",
    "storageUri": "[concat(parameters('_artifactsLocation'), '/database.bacpac')]",
    "administratorLogin": "[parameters('sqlServerAdminLogin')]",
    "administratorLoginPassword": "[parameters('sqlServerAdminLoginPassword')]",
    "operationMode": "Import"
  }
}

See also this documentation about all the properties and possible values: https://msdn.microsoft.com/en-us/library/azure/mt683388.aspx.

You should double check if the version of the target logical server is V12 as well (or same as source). Also, for copy an existing Azure Sql Database you can use database copy API ("createMode": "Copy"): https://msdn.microsoft.com/en-us/library/mt163685.aspx

Thanks,

Mihaela

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!