JSON parameters are not parsed correctly using CMD
See original GitHub issueIt seems to be parsing this incorrectly and I’m not sure why?
az vmss extension set --publisher Microsoft.Azure.Extensions --version 2.0 --name CustomScript --resource-group vmss-test-1 --vmss-name myscaleset --settings '{"commandToExecute": "apt-get -y update && apt-get -y install nginx"}'
az: error: unrecognized arguments: apt-get -y update && apt-get -y install nginx}'
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Passing JSON Parameters on the Command Line
Here you'll find examples of correct escaping and quotes when passing JSON objects on the command line using different shells.
Read more >Pass a JSON string as a command line argument
Declare it as a string with "" and escape the other " with \ and it should work. Command line:
Read more >[SOLVED] Problems with JSON parsing errors - Ubidots API
I want to test setting a variable to a value. My device is called mqttdata and the variable is called number. My curl...
Read more >Parsing JSON with PowerShell - Microsoft Community Hub
Q: I try to parse my JSON with the handy dandy “ConvertFrom-JSON” cmdlet but it only works in PowerShell 7, not in my...
Read more >SyntaxError: JSON.parse: bad parsing - JavaScript | MDN
You cannot use single-quotes around properties, like 'foo'. JSON.parse("{'foo': 1}"); ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For the meantime, I’ve confirmed this works:
You need to escape the & with ^, and you have to replace
az
withpython -m azure.cli
. I will see if we can fix this through a tweak toaz.bat
I am sorry for the flashback but I am having issues passing --indexing-policy to cosmosdb as a string. I get all sorts of errors. I saw this statement –settings @settings.json
But I do not understand how exactly should I use it… let’s say I save my json to disk as “C:\path\my.json” . How exactly do I pass this file as parameter? If I put the path as a string or not, it simply fails at first character, even less info compared to when I pass the json as string argument. What exactly is that fancy @ sign and what is the step by step procedure to give a disk file as argument to one of the azure cli commands.