我正在尝试使用Azure资源管理器在Azure上配置一些资源,并将模板放在一起; 我正在同时配置多个具有独立服务计划的网络应用程序。当然,每个Web应用程序资源“依赖于”其服务计划。
每次使用Powershell进行部署时,我都会遇到以下错误:
New-AzureRmResourceGroupDeployment:4:21:22 PM - 资源Microsoft.Web / serverfarms'ServicePlanA'失败,显示消息'无法找到Web空间 ExampleResourceGroup-AustraliaEastwebspace for subscription ...'
这在一个或多个服务计划中随机失败。
我也发现了这个GitHub问题,但由于我没有使用CLI,我看不出这会有什么帮助https://github.com/Azure/azure-xplat-cli/issues/1646
我还有来自https://www.powershellgallery.com/packages/AzureRM/
的最新AzureRM软件包我使用的API版本是“2015-08-01”,部署模板的架构是https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#
以下是模板中创建上述资源的段:
{
"name": "[variables('WebFrontServicePlanAName')]",
"type": "Microsoft.Web/serverfarms",
"location": "[parameters('DataCenterALocation')]",
"apiVersion": "2015-08-01",
"dependsOn": [ ],
"tags": {
"displayName": "WebFrontServicePlanA"
},
"sku": {
"name": "[parameters('WebFrontServicePlanSKU')]"
},
"properties": {
"name": "[variables('WebFrontServicePlanAName')]",
"workerSize": "[parameters('WebFrontServicePlanAWorkerSize')]",
"numberOfWorkers": 1
}
},
....
{
"name": "[variables('webAppName')]",
"type": "Microsoft.Web/sites",
"location": "[parameters('DataCenterALocation')]",
"apiVersion": "2015-08-01",
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', variables('WebFrontServicePlanAName'))]"
],
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', variables('WebFrontServicePlanAName'))]": "Resource",
"displayName": "webApp"
},
"properties": {
"name": "[variables('webAppName')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms/', variables('WebFrontServicePlanAName'))]"
},
}
答案 0 :(得分:0)
您是否已经拥有要部署的现有资源组?如果不是,请尝试使用cmdlet New-AzureRmResourceGroup
而不是New-AzureRmResourceGroupDeployment
。
在Azure Web Apps中,资源组由网站空间支持。因此,资源组可以包含多个网络空间,每个网站空间位于不同的地理区域中。如果您没有资源组,并且您没有创建它,那么您将没有相应的网站空间,这会导致您看到的错误。