在 Azure CLI 中获取用于部署自定义脚本扩展的期望值错误

Getting error of Expecting Value in Azure CLI for deploying Custom Script Extension

提前致谢,我正在尝试从 Cloud Shell 部署来自 Azure CLI 的自定义脚本扩展。但是得到期望值的错误。我正在使用 SAS 密钥下载 PS 文件。我已经尝试使用所有可能的方法来添加受保护的设置,并指向 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

error image

对于你的问题,这只是一个错误。参数 --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"}'