我正在使用ARM模板创建Azure资源。我已经运行过一次模板,在资源组中创建了一个SQL服务器和数据库。它工作得很好。当我用不同的参数再次运行它时,它成功地创建了SQL Server,但是失败了,数据库出现了一条模糊的消息。
摘自我的手臂模板:
{
"type": "Microsoft.Sql/servers",
"kind": "v12.0",
"name": "[variables('sqlServer_name')]",
"apiVersion": "2015-05-01-preview",
"location": "[parameters('resourceLocation')]",
"tags": "[variables('environmentTags')]",
"properties": {
"administratorLogin": "[parameters('sqlServerAdminAccountName')]",
"administratorLoginPassword": "[parameters('sqlServerAdminAccountPassword')]",
"version": "12.0"
},
"resources": [
{
"name": "EnableAzureServicesFirewallRule",
"type": "firewallRules",
"apiVersion": "2015-05-01-preview",
"properties": {
"startIpAddress": "0.0.0.0",
"endIpAddress": "0.0.0.0"
},
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', variables('sqlServer_name'))]"
]
}
]
},
{
"type": "Microsoft.Sql/servers/databases",
"sku": "[variables('databaseSizeSkuMap')[parameters('sqlServerDatabaseSize')]]",
"kind": "v12.0,user",
"name": "[concat(variables('sqlServer_name'), '/', variables('sqlServerDatabase_name'))]",
"apiVersion": "2017-03-01-preview",
"location": "[parameters('resourceLocation')]",
"tags": "[variables('environmentTags')]",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', variables('sqlServer_name'))]"
]
}
SKU是
{ "name": "Free", "tier": "Free" }
.
运行模板将生成两个单独的资源组,每个资源组都有一个SQL Server实例:
资源组开发
-
服务器:SQL MyAppName开发
-
数据库:sql myappname dev/dbname
资源组测试
-
服务器:SQL MyAppName测试
-
数据库:sql myappname test/dbname<---创建失败
错误信息:
New-AzureRmResourceGroupDeployment : 6:21:23 PM - Resource Microsoft.Sql/servers/databases 'sql-myappname-test/DbName' failed with message '{
"status": "Failed",
"error": {
"code": "ResourceDeploymentFailure",
"message": "The resource operation completed with terminal provisioning state 'Failed'.",
"details": [
{
"code": "InternalServerError",
"message": "An unexpected error occured while processing the request. Tracking ID: '438f9ade-e84f-4627-acec-1156ea54aa65'"
}
]
}
}'
这里的问题是什么?我已经能够通过Azure门户在不同的服务器上创建具有相同名称的数据库。另外,如果我删除
资源组开发
,然后运行模板
资源组测试
创建数据库成功。