az graph

Query the resources managed by Azure Resource Manager.

Run 'az graph query --help' for detailed help.

Commands

az graph query Query the resources managed by Azure Resource Manager.

az graph query

Query the resources managed by Azure Resource Manager.

az graph query --graph-query
[--first]
[--skip]
[--subscriptions]

Examples

Query resources requesting a subset of resource fields.

az graph query -q "project id, name, type, location, tags"

Query resources with field selection, filtering and summarizing.

az graph query -q "project id, type, location | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by location | top 3 by count_"

Request a subset of results, skipping 20 items and getting the next 10.

az graph query -q "where type =~ "Microsoft.Compute" | project name, tags" --first 10 --skip 20

Choose subscriptions to query.

az graph query -q "where type =~ "Microsoft.Compute" | project name, tags" --subscriptions 11111111-1111-1111-1111-111111111111, 22222222-2222-2222-2222-222222222222

Required Parameters

--graph-query --q -q

Resource Graph query to execute.

Optional Parameters

--first

The maximum number of objects to return. Accepted range: 1-5000.

default value: 100
--skip

Ignores the first N objects and then gets the remaining objects.

--subscriptions -s

List of subscriptions to run query against. By default all accessible subscriptions are queried.