提前致谢,我正在尝试通过 Cloud Shell 从 Azure CLI 部署自定义脚本扩展。但得到期望值的错误。我正在使用 SAS key 下载 PS 文件。我尝试使用所有可能的方法来添加 protected 设置,并指向 json,但它仍然给我一个错误。 使用以下 Azure CLI 命令
az vm extension set --name CustomScriptExtension --publisher Microsoft.Compute --settings '{"fileUris": ["https://archivewsldisks.blob.core.windows.net/container/newfolder.ps1?sp=rcwd&st=2019-06-20T06:27:08Z&se=2019-07-31T14:27:08Z&spr=https&sv=2018-03-28&sig=oRzT7soN%2B2jvL6CxtYN%2B435B7XJYf05TgyPya2VR43Y%3D&sr=b"], "commandToExecute":powershell -ExecutionPolicy Unrestricted -File newfolder.ps1}' --resource-group "vm-test-group" --vm-name "testvm1" --version 1.9
最佳答案
对于你的问题,这只是一个错误。参数 --setting
需要一个 JSON 值,而您执行的命令缺少其中的引号。只需更改参数 --setting
的值,如下所示:
--settings '{"fileUris": ["https://archivewsldisks.blob.core.windows.net/container/newfolder.ps1?sp=rcwd&st=2019-06-20T06:27:08Z&se=2019-07-31T14:27:08Z&spr=https&sv=2018-03-28&sig=oRzT7soN%2B2jvL6CxtYN%2B435B7XJYf05TgyPya2VR43Y%3D&sr=b"], "commandToExecute": "powershell -ExecutionPolicy Unrestricted -File newfolder.ps1"}'
关于azure - 在 Azure CLI 中部署自定义脚本扩展时出现预期值错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56680756/