【发布时间】:2017-07-21 18:52:58
【问题描述】:
powershell -File './scripts/myscript.ps1' -Param1 "My Param"
部署自定义脚本扩展所需的语法是什么,该扩展调用 PowerShell 文件,其中包含空格的参数。到目前为止,这些都是我尝试过的,但都没有奏效。其中每一个都与我的 ARM 模板中的一样:
# Failed to being executing the script. Error from the logs on the VM: "VMExtensionProvisioningError"
"[concat('powershell -File InstallVSTSAgent.ps1 -vstsAccount \"', parameters('vstsAccount'), '\"')]"
# Failed in the same way.
"[concat('powershell -File InstallVSTSAgent.ps1 -vstsAccount \\\"', parameters('vstsAccount'), '\\\"')]"
# Ran, but the parameters entering my PowerShell file were wrapped in `ticks`
"[concat('powershell -File InstallVSTSAgent.ps1 -vstsAccount `\"', parameters('vstsAccount'), '`\"')]"
【问题讨论】:
-
第一个应该可以,我不认为问题出在模板中。
-
@4c74356b41 - 你是对的。我又试了一次,它奏效了。这一定是我之前修复的脚本中的另一个问题。
标签: azure arm-template