Commands for interacting with Azure Resource Graph.
Azure Resource Graph is an Azure service designed to help explore Azure resources at scale across a subscription or management group. It provides a powerful query language (Kusto Query Language - KQL) to discover and analyze your Azure resources.
az resourcegraph query --graph-query
Runs a Resource Graph query and returns the results.
| Parameter | Description | Required | 
|---|---|---|
| --graph-query | The Resource Graph query to execute. | Yes | 
| -l, --last | The time interval for the query. For example, '1h', '7d', '30d'. | No | 
| -m, --management-group | The ID of the management group to scope the query to. | No | 
| -s, --subscription | The ID of the subscription to scope the query to. | No | 
| -o, --output | Output format. Values include: json, jsonc, table, tsv, yaml, none. Default is json. | No | 
| --top | The maximum number of records to return. | No | 
| --skip | The number of records to skip. | No | 
az resourcegraph query --graph-query "Resources | summarize count()" --output tableaz resourcegraph query --graph-query "Resources | where type =~ 'microsoft.compute/virtualmachines' | project name, properties.osProfile.computerName, properties.hardwareProfile.vmSize" --output table --subscription "YOUR_SUBSCRIPTION_ID"az resourcegraph count --graph-query
Counts the number of resources that match the given Resource Graph query.
| Parameter | Description | Required | 
|---|---|---|
| --graph-query | The Resource Graph query to execute. | Yes | 
| -l, --last | The time interval for the query. For example, '1h', '7d', '30d'. | No | 
| -m, --management-group | The ID of the management group to scope the query to. | No | 
| -s, --subscription | The ID of the subscription to scope the query to. | No | 
az resourcegraph count --graph-query "Resources | where type =~ 'microsoft.storage/storageaccounts'"az resourcegraph list --graph-query
Lists resources that match the given Resource Graph query. This is an alias for az resourcegraph query with output format set to 'table'.
| Parameter | Description | Required | 
|---|---|---|
| --graph-query | The Resource Graph query to execute. | Yes | 
| -l, --last | The time interval for the query. For example, '1h', '7d', '30d'. | No | 
| -m, --management-group | The ID of the management group to scope the query to. | No | 
| -s, --subscription | The ID of the subscription to scope the query to. | No | 
| --top | The maximum number of records to return. | No | 
| --skip | The number of records to skip. | No | 
az resourcegraph list --graph-query "Resources | where type =~ 'microsoft.network/virtualnetworks'"