Search code examples
azureazure-cliazure-cli2

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


Thanks in advance, I'm trying to deploy custom script extension from Azure CLI from Cloud Shell. But getting error of expecting value. I'm using SAS key to download the PS file. I've tried to use every possible way of adding Protected settings, and Pointing to json but it still gives me an error. With the below Azure CLI Command

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


Solution

  • For your issue, it's just a mistake. The parameter --setting expect a JSON value and the command you execute misses the quotation marks in it. Just change the value of the parameter --setting like this:

    --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"}'