How to use Azure az cli –query

The --query parameter is supported by all commands in the Azure CLI and operates on the client side returned value of the az command.

The query is called a JMESPath query which is a query language for JSON.

so for the following json object

{
  "account": {
     "name" : "John",
     "id" : "324",
     "subscription" : {
        "name" : "pay monthly" 
}

then the query “account.subscription.name” would return “pay monthly”.

Not the same as Resource Graph query using Azure CLI, which is of the form

az graph query -q 'Resources | project name, type'

References:

https://docs.microsoft.com/en-us/cli/azure/query-azure-cli?tabs=concepts%2Cbash