我要执行以下操作
我遇到如下错误
错误:部署模板验证失败:“资源 在以下位置未定义“ Microsoft.Resources / deployments / clusterTemplate” 模板。请参阅https://aka.ms/arm-template以了解用法 详细信息。”
我该如何解决这个问题?
{
"apiVersion": "[variables('resourceDeploymentApiVersion')]",
"name":"[variables('clusterTemplateName')]",
"type": "Microsoft.Resources/deployments",
"resourceGroup": "[parameters('clusterResourceGroupName')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('clusterTemplateURL')]"
},
"parameters": {
"clusterName": { "value": "[parameters('clusterName')]"
}
}
},
{
"apiVersion": "[variables('resourceDeploymentApiVersion')]",
"name": "[variables('vmTemplateName')]",
"type": "Microsoft.Resources/deployments",
"resourceGroup": "[parameters('vmResourceGroupName')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('vmTemplateURL')]"
},
"parameters": {
"appid": { "value": "[parameters('appid')]" }
}
}
},
{
"apiVersion": "[variables('resourceDeploymentApiVersion')]",
"name": "[variables('vmTemplateName1')]",
"type": "Microsoft.Resources/deployments",
"resourceGroup": "[parameters('vmResourceGroupName')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('vmTemplateURL1')]"
},
"parameters": {
"appid": { "value": "[parameters('appid')]" }
}
}
},
{
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat('vmName','/install-script')]",
"apiVersion": "[variables('computeApiVersion')]",
"location": "[variables('location')]",
"dependsOn": [
"[resourceId('Microsoft.Resources/deployments', variables('clusterTemplateName'))]",
"[resourceId('Microsoft.Resources/deployments', variables('vmTemplateName'))]"
],
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.0",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": ["[variables('installScript')]"]
},
"protectedSettings":{
"commandToExecute": "[concat('bash init.sh', ' ', parameters('appId'))]"
}
}
},{
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat('vmName','/install-script')]",
"apiVersion": "[variables('computeApiVersion')]",
"location": "[variables('location')]",
"dependsOn": [
"[resourceId('Microsoft.Resources/deployments', variables('vmTemplateName'))]",
"[resourceId('Microsoft.Resources/deployments', variables('vmTemplateName1'))]"
],
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.0",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": ["[variables('installScript')]"]
},
"protectedSettings":{
"commandToExecute": "[concat('bash init.sh', ' ', parameters('appId'))]"
}
}
}
答案 0 :(得分:0)
我可以通过在resourceId中使用群集资源组名称来解决此问题
之前:-
"[resourceId('Microsoft.Resources/deployments', variables('clusterTemplateName'))]",
之后:-
"dependsOn": [
"[resourceId(parameters('clusterResourceGroupName'), 'Microsoft.Resources/deployments', variables('clusterTemplateName'))]",