【发布时间】:2019-12-26 20:25:19
【问题描述】:
我正在使用 ARM 模板创建一个 azure 市场报价。我正在使用我的 ARM 模板创建 Linux VM。我需要在部署后运行自定义配置脚本。我按照 azure quickstart repo 中提供的示例进行操作。
https://github.com/Azure/azure-quickstart-templates/tree/master/100-marketplace-sample 当我尝试验证模板时,出现以下错误。
{ "error": {
"additionalInfo": [
{
"info": {
"lineNumber": 166,
"linePosition": 28,
"path": "resources[1].type"
},
"type": "TemplateViolation"
}
],
"code": "InvalidTemplate",
"details": null,
"message": "Deployment template validation failed: 'The template resource 'configScript' at line '166' and column '28' is not valid. The type property is invalid. Please see https://aka.ms/arm-template/#resources for usage details.'.",
"target": null
},
“属性”:空
}
我的模板的脚本部分看起来像
{
"type": "extensions",
"name": "configScript",
"apiVersion": "2018-04-01",
"location": "[parameters('location')]",
"dependsOn": [
"[parameters('vmName')]"
],
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.0",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": [
"[uri(parameters('_artifactsLocation'), concat('scripts/copyfilefromazure.sh', parameters('_artifactsLocationSasToken')))]"
]
},
"protectedSettings": {
"commandToExecute": "[concat('bash ', variables('scriptFileName'), ' ', variables('scriptArgs'))]"
}
}
},
【问题讨论】:
-
你在虚拟机资源[]中有这个吗?您将定义模板的资源[],然后您应该在其中包含 Microsoft.Compute/virtualMachines 资源[]。您的 CustomScript 应该在 VM 资源[] 中
标签: azure azure-resource-manager azure-marketplace