【发布时间】:2018-10-24 13:44:43
【问题描述】:
因此,我正在尝试部署一个模板,该模板将站点设置为站点 vpn,并具有一个嵌套模板,该模板将设置连接到 azure 端的虚拟机。每个模板都可以单独工作,也可以作为嵌套模板一起工作。
当我想将站点到站点部署在一个资源组中并将 VM 和相关对象部署到另一个资源组时,问题就出现了。
我整理了以下代码:
{
"condition": "[equals(parameters('deployVm'),'True')]",
"type": "Microsoft.Resources/resourceGroups",
"name": "[variables('deployments').resourceGroup.name]",
"apiVersion": "2018-08-01",
"location": "[variables('deployments').resourceGroup.location]",
"properties": {}
},
{
"condition": "[equals(parameters('deployVm'),'True')]",
"type": "Microsoft.Resources/deployments",
"name": "[variables('deployments').name]",
"apiVersion": "2017-05-10",
"resourceGroup": "[variables('deployments').resourceGroup.name]",
"properties": {
"mode": "[variables('deployments').mode]",
"templateLink": {
"uri": "[variables('deployments').templateLink.uri]",
"contentVersion": "[variables('deployments').templateLink.contentVersion]"
},
"parameters": {}
}
},
"dependsOn": [
"[resourceId('Microsoft.Resources/resourceGroups/', variables('deployments').resourceGroup.name)]"
]
}
根据我整理的其他一些模板,我不明白为什么在部署我在依赖部分中设置的资源组时没有创建。
当我运行模板时,Azure 抱怨找不到资源组“[variables('deployments').resourceGroup.name]”。
【问题讨论】:
-
deployVm 参数是否设置正确?
-
是的,但我确实尝试在没有条件行的情况下运行模板,但它仍然给我同样的错误,说资源组不存在。
-
看看这个模板:github.com/Azure/azure-quickstart-templates/tree/master/… - 如果这没有帮助,我们可能需要查看整个模板以了解发生了什么。
-
该模板也不起作用,您是否可以访问 azure 帐户?如果你运行它,它对你有用,因为它不适合我。关于找不到资源组的相同错误。
标签: json azure azure-resource-manager azure-resource-group