I'm attempting the following Azure CLI command and query from PowerShell:
az account list-locations --query [?contains(name,"us")].[displayName,name]
Unfortunately the --query
parameter gives me this error:
Missing argument in parameter list
...and it points to the comma in the contains
function. That's a surreal error, since the contains
function only takes two arguments...and both are present. Furthermore, I have tested the above syntax in the jmespath online fiddle, where it works just fine.
In that online fiddle, I successfully used this expression:
[?contains(state,'WA')].name | sort(@) | {WashingtonCities: join(', ', @)}
The data for the above sample, is as follows:
[
{"name": "Seattle", "state": "WA"},
{"name": "New York", "state": "NY"},
{"name": "Bellevue", "state": "WA"},
{"name": "Olympia", "state": "WA"}
]
So what could possibly be wrong with --query
that I'm passing to the Azure CLI?
I have also attempted this alternate contains
syntax someone proposed, which also didn't work.