I’m using more and more the Azure CLI 2.0, which makes my scripting life with Azure Resources a lot easier.
The default output of the Azure CLI is json, but you can also use other kind of output formats, as described in this blog.
I want to have some variables that I can reuse in other commands, so let’s say I want to get the name of all the Resource Groups which have a tag called Kind with a value VM, I can use the following JMESPath query:
az group list --query "[?tags.Kind=='VM'].name"
The output will be:
[ "Development", "Mystique" ]