Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Diagnose Azure service issues, query logs, and troubleshoot failures using GitHub Copilot for Azure
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/azure-resource-graph.md
1# Azure Resource Graph Queries for Diagnostics23Azure 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.45## How to Query67Use the `extension_cli_generate` MCP tool to generate `az graph query` commands:89```yaml10mcp_azure_mcp_extension_cli_generate11intent: "query Azure Resource Graph to <describe what you want to diagnose>"12cli-type: "az"13```1415Or construct directly:1617```bash18az graph query -q "<KQL>" --query "data[].{name:name, type:type}" -o table19```2021> ⚠️ **Prerequisite:** `az extension add --name resource-graph`2223## Key Tables2425| Table | Contains |26|-------|----------|27| `Resources` | All ARM resources (name, type, location, properties, tags) |28| `HealthResources` | Resource health availability status |29| `ServiceHealthResources` | Azure service health events and incidents |30| `ResourceContainers` | Subscriptions, resource groups, management groups |3132## Diagnostics Query Patterns3334**Check resource health status across resources:**3536```kql37HealthResources38| where type =~ 'microsoft.resourcehealth/availabilitystatuses'39| project name, availabilityState=properties.availabilityState, reasonType=properties.reasonType40```4142**Find resources in unhealthy or degraded state:**4344```kql45HealthResources46| where type =~ 'microsoft.resourcehealth/availabilitystatuses'47| where properties.availabilityState != 'Available'48| project name, state=properties.availabilityState, reason=properties.reasonType, summary=properties.summary49```5051**Query active service health incidents:**5253```kql54ServiceHealthResources55| where type =~ 'microsoft.resourcehealth/events'56| where properties.Status == 'Active'57| project name, title=properties.Title, impact=properties.Impact, status=properties.Status58```5960**Find resources by provisioning state (failed/stuck deployments):**6162```kql63Resources64| where properties.provisioningState != 'Succeeded'65| project name, type, resourceGroup, provisioningState=properties.provisioningState66```6768**Find App Services in stopped or error state:**6970```kql71Resources72| where type =~ 'microsoft.web/sites'73| where properties.state != 'Running'74| project name, state=properties.state, resourceGroup, location75```7677**Find Container Apps with provisioning issues:**7879```kql80Resources81| where type =~ 'microsoft.app/containerapps'82| where properties.provisioningState != 'Succeeded'83| project name, provisioningState=properties.provisioningState, resourceGroup84```8586## Tips8788- Use `=~` for case-insensitive type matching (resource types are lowercase)89- Navigate properties with `properties.fieldName`90- Use `--first N` to limit result count91- Use `--subscriptions` to scope to specific subscriptions92- Combine ARG health data with Azure Monitor metrics for full picture93- Check `HealthResources` before deep-diving into application logs94