使用Azure资源管理器复制Azure SQL数据库

使用Azure资源管理器复制Azure SQL数据库,azure,azure-sql-database,azure-resource-manager,Azure,Azure Sql Database,Azure Resource Manager,我目前正在使用ARM创建环境部署包,我希望能够将现有Azure SQL数据库(架构和数据)复制到新资源组中的另一个Azure SQL数据库。我从原始SQL数据库创建了一个.bacpac文件,并将其上载到一个存储帐户中。然后,我在模板中添加了一个SQL数据库导入资源,并将其指向我创建的.bacpac文件的URI。当我尝试运行部署时,会出现此错误 将Microsoft Azure SQL数据库v12指定为 无法将目标平台发布到Microsoft Azure SQL数据库 非常感谢您的帮助。您应该仔细

我目前正在使用ARM创建环境部署包,我希望能够将现有Azure SQL数据库(架构和数据)复制到新资源组中的另一个Azure SQL数据库。我从原始SQL数据库创建了一个.bacpac文件,并将其上载到一个存储帐户中。然后,我在模板中添加了一个SQL数据库导入资源,并将其指向我创建的.bacpac文件的URI。当我尝试运行部署时,会出现此错误

将Microsoft Azure SQL数据库v12指定为 无法将目标平台发布到Microsoft Azure SQL数据库


非常感谢您的帮助。

您应该仔细检查目标逻辑服务器的版本是否也是V12(或与源服务器相同)。 此外,对于复制现有Azure Sql数据库,您可以使用数据库复制API(“createMode”:“copy”):

谢谢


Mihaela

问题是您对
storageKeyType
使用了错误的值。您需要使用
StorageAccessKey

我使用这样和那样的模板工作正常,唯一的区别就是这个键类型

{
“名称”:“[concat(变量('sqlServerName'),'/databasename/Import')]”,
“类型”:“Microsoft.Sql/servers/databases/extensions”,
“apiVersion”:“[变量('sqlServerApiVersion')]”,
“标签”:{
“displayName”:“复制Azure SQL数据库”
},
“财产”:{
“storageKeyType”:“StorageAccessKey”,
“storageKey”:“[ListKey(变量('storageId')、变量('storageVersion')).key1]”,
“storageUri”:“[concat(parameters(“'u artifactsLocation'),'/database.bacpac')”,
“管理员登录”:“[参数('sqlServerAdminLogin')]”,
“管理员登录密码”:“[参数('sqlServerAdminLoginPassword')]”,
“操作模式”:“导入”
}
}

另请参阅有关所有属性和可能值的文档:。

能否通过SSMS部署此bacpac?
 {
      "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"
          }
        }
      ]
    }