Setting the file. One moment.
Chapter 15 · Azure Diagnostics
Subchapter 15.2
references/azure-resource-graph.mdMarkdown3 KBView on GitHub
Azure Resource Graph (ARG) enables fast, cross-subscription resource querying using KQL via az graph query. Use it to check resource health, find degraded resources, and correlate incidents.
Use the extension_cli_generate MCP tool to generate az graph query commands:
mcp_azure_mcp_extension_cli_generate
intent: "query Azure Resource Graph to <describe what you want to diagnose>"
cli-type: "az"Or construct directly:
az graph query -q "<KQL>" --query "data[].{name:name, type:type}" -o table⚠️ Prerequisite:
az extension add --name resource-graph
| Table | Contains |
|---|---|
Resources | All ARM resources (name, type, location, properties, tags) |
HealthResources | Resource health availability status |
ServiceHealthResources | Azure service health events and incidents |
ResourceContainers | Subscriptions, resource groups, management groups |
Check resource health status across resources:
HealthResources
| where type =~ 'microsoft.resourcehealth/availabilitystatuses'
| project name, availabilityState=properties.availabilityState, reasonType=properties.reasonTypeFind resources in unhealthy or degraded state:
HealthResources
| where type =~ 'microsoft.resourcehealth/availabilitystatuses'
| where properties.availabilityState != 'Available'
| project name, state=properties.availabilityState, reason=properties.reasonType, summary=properties.summaryQuery active service health incidents:
ServiceHealthResources
| where type =~ 'microsoft.resourcehealth/events'
| where properties.Status == 'Active'
| project name, title=properties.Title, impact=properties.Impact, status=properties.StatusFind resources by provisioning state (failed/stuck deployments):
Resources
| where properties.provisioningState != 'Succeeded'
| project name, type, resourceGroup, provisioningState=properties.provisioningStateFind App Services in stopped or error state:
Resources
| where type =~ 'microsoft.web/sites'
| where properties.state != 'Running'
| project name, state=properties.state, resourceGroup, locationFind Container Apps with provisioning issues:
Resources
| where type =~ 'microsoft.app/containerapps'
| where properties.provisioningState != 'Succeeded'
| project name, provisioningState=properties.provisioningState, resourceGroup=~ for case-insensitive type matching (resource types are lowercase)properties.fieldName--first N to limit result count--subscriptions to scope to specific subscriptionsHealthResources before deep-diving into application logs