我无法在Red Hat 7.2上运行自定义脚本扩展。我尝试了最新的扩展,并在我的ARM模板中包含以下内容-
{
"name": "[concat(parameters('VMNamePrefix'), parameters('startingNumeral')[copyindex()],'/',parameters('VMNamePrefix'), parameters('startingNumeral')[copyindex()],'-CUSTOMSCRIPT')]",
"type": "Microsoft.Compute/virtualMachines/extensions",
"location": "[parameters('region')]",
"apiVersion": "[variables('apiVersionVirtualMachines')]",
"tags": {
"ApmID": "[parameters('apmID')]",
"ApplicationName": "[parameters('applicationName')]",
"SharedService": "[parameters('sharedService')]",
"PaaSOnly": "[parameters('paasOnly')]"
},
"copy": {
"name": "customScriptLoop",
"count": "[parameters('vmInstanceCount')]"
},
"dependsOn": [
"[concat(parameters('VMNamePrefix'), parameters('startingNumeral')[copyindex()])]"
],
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.0",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": [
"[variables('customScriptUri')]"
]
},
"protectedSettings": {
"commandToExecute": "[parameters('customScriptCommand')]"
}
}
}
要执行的命令是pwd
,但是大约90分钟后,该扩展名放弃了,我在Red Hat 7.2的waagent.log
日志文件中看到以下内容-
2018/09/10 13:30:49.361162 INFO [Microsoft.Compute.CustomScriptExtension-1.9.1] Target handler state: enabled
2018/09/10 13:30:49.390061 INFO [Microsoft.Compute.CustomScriptExtension-1.9.1] [Enable] current handler state is: notinstalled
2018/09/10 13:30:49.585331 INFO [Microsoft.Compute.CustomScriptExtension-1.9.1] Initialize extension directory
2018/09/10 13:30:49.615784 INFO [Microsoft.Compute.CustomScriptExtension-1.9.1] Update settings file: 0.settings
2018/09/10 13:30:49.644631 INFO [Microsoft.Compute.CustomScriptExtension-1.9.1] Install extension [install.cmd]
2018/09/10 13:30:50.678474 WARNING [Microsoft.Compute.CustomScriptExtension-1.9.1] [ExtensionError] Non-zero exit code: 127, install.cmd
2018/09/10 13:30:50.713928 INFO [Microsoft.Compute.CustomScriptExtension-1.9.1] Remove extension handler directory: /var/lib/waagent/Microsoft.Compute.CustomScriptExtension-1.9.1
2018/09/10 13:30:50.723392 INFO ExtHandler ProcessGoalState completed [incarnation 4; 1534 ms]
我也没有看到其他任何日志。任何想法可能出什么问题吗?当我手动从门户网站安装“自定义脚本”扩展程序时,它工作正常。
谢谢, 普拉纳夫