问题描述
az vm extension set \
-资源组QuickstartAnsible-rg
--vm-name QuickstartAnsible-vm
--name customScript
--publisher Microsoft.Azure.Extensions
--version 2.1
--settings'{“ fileUris”:[“ https://raw.githubusercontent.com/MicrosoftDocs/mslearn-ansible-control-machine/master/configure-ansible-centos.sh”]}''
--protected-settings'{“ commandToExecute”:“ ./configure-ansible-centos.sh”}'
解决方法
当它在PowerShell ISE上运行时,我可以重现此错误,但是它可以在WSL的Bash环境中工作。
在PowerShell上,您可以像这样在双引号中加上代码。
az vm extension set --resource-group "nancytest" --vm-name "ubun-a" --name "customScript" --publisher "Microsoft.Azure.Extensions" --version 2.1 --settings "{'fileUris':['https://raw.githubusercontent.com/MicrosoftDocs/mslearn-ansible-control-machine/master/configure-ansible-centos.sh']}" --protected-settings "{'commandToExecute':'./configure-ansible-centos.sh'}"