使用Azure资源管理器复制Azure SQL数据库 [英] Using Azure Resource Manager to Copy Azure SQL Databases
问题描述
我当前正在使用ARM创建环境部署程序包,并且希望能够将现有的Azure SQL数据库(模式和数据)复制到新资源组中的另一个Azure SQL数据库中.我从原始SQL数据库创建了一个.bacpac文件,并将其上传到存储帐户中.然后,我将SQL数据库导入资源添加到模板中,并将其指向我创建的.bacpac文件的URI.当我尝试运行部署时,出现此错误.
I am currently creating an Environment Deployment Package using ARM and I want to be able copy an existing Azure SQL Database (schema and data) to another Azure SQL Database in a new Resource Group. I created a .bacpac file from the original SQL Database and uploaded it into a Storage Account. I then added a SQL Database Import Resource to my Template and pointed it at the URI of the .bacpac file I created. When I try to run the Deployment, I get this error.
一个项目,将Microsoft Azure SQL数据库v12指定为 目标平台无法发布到Microsoft Azure SQL数据库
A project which specifies Microsoft Azure SQL Database v12 as the target platform cannot be published to Microsoft Azure SQL Database
{
"name": "[concat(parameters('environment'),'dbagg')]",
"type": "databases",
"location": "[resourceGroup().location]",
"apiVersion": "2014-04-01-preview",
"dependsOn": [
"[variables('sqlServerName')]"
],
"tags": {
"displayName": "AggregationDatabase"
},
"properties": {
"collation": "[parameters('AggregationDatabaseCollation')]",
"edition": "[parameters('AggregationDatabaseEdition')]",
"maxSizeBytes": "1073741824",
"requestedServiceObjectiveName": "[parameters('AggregationDatabaseRequestedServiceObjectiveName')]"
},
"resources": [
{
"name": "Import",
"type": "extensions",
"apiVersion": "2014-04-01-preview",
"dependsOn": [
"[concat(parameters('environment'),'dbagg')]"
],
"tags": {
"displayName": "Copy Azure SQL DB"
},
"properties": {
"storageKeyType": "Primary",
"storageKey": "key",
"storageUri": "https://test.blob.core.windows.net/databasefiles/AggregationServerDCT.bacpac",
"administratorLogin": "[parameters('sqlAdminLogin')]",
"administratorLoginPassword": "[parameters('sqlAdminLoginPassword')]",
"operationMode": "Import"
}
}
]
}
对此,任何帮助将不胜感激.
Any help would be greatly appreciated on this.
推荐答案
问题是您为storageKeyType
使用了错误的值.您需要使用StorageAccessKey
.
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"
}
}
另请参阅有关所有属性和可能值的此文档: https://msdn.microsoft.com/zh-CN/library/azure/mt683388.aspx .
See also this documentation about all the properties and possible values: https://msdn.microsoft.com/en-us/library/azure/mt683388.aspx.
这篇关于使用Azure资源管理器复制Azure SQL数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!