As a cloud engineer/SRE, we often need to efficiently query and analyze cloud resources for governance, security, and cost management. Azure Resource Graph Explorer (ARG Explorer) is a powerful tool designed to provide deep insights into Azure resources at scale. In this post, we will explore:
- What Azure Resource Graph Explorer is
- Key use cases for cloud engineers and SREs
- Practical Kusto Query Language (KQL) queries to retrieve valuable cloud insights
What is Azure Resource Graph Explorer?
Azure Resource Graph Explorer is a service that enables high-performance, scalable querying of Azure resources across multiple subscriptions using Kusto Query Language (KQL). Unlike Azure Resource Manager (ARM), which retrieves live data on-demand, Azure Resource Graph (ARG) uses an indexed cache that allows for fast and efficient queries across your entire Azure environment.
Key Features of ARG Explorer:
- Fast and scalable queries across multiple Azure subscriptions and tenants
- Supports complex filtering, aggregations, and joins
- Integration with Azure Portal, Azure CLI, PowerShell, and REST API
ARG Explorer is part of Azure portal, so you can simply search for it and start running your queries.


Why Use Azure Resource Graph Explorer?
When I need to aggregate and analyze data across Azure subscriptions to gain a holistic view, ARG Explorer is usually my preferred choice instead of PowerShell or Azure CLI commands. ARG Explorer typically helps with:
- Inventory Management: Retrieve a list of resources by type, location, and compliance status
- Security and Compliance: Identify misconfigurations or security risks in your Azure environment
- Cost Optimization: Find unused or underutilized resources to optimize spending
- Policy Auditing: Check if resources comply with governance and tagging policies
Next, let’s check some practical queries I used at work!
Practical Use Cases with Kusto Queries
List Virtual Machines, Breaking by Subscriptions or OS Types
# List all VMs
resources
| where type == "microsoft.compute/virtualmachines"
| project name, location, resourceGroup, subscriptionId
# Break the number by subscriptions
resources
| where type == "microsoft.compute/virtualmachines"
| summarize VMsBySubscription = count() by subscriptionId
# Break by osType
resources
| where type == "microsoft.compute/virtualmachines"
| extend osType = properties.storageProfile.osDisk.osType
| summarize count() by tostring(osType)
Identify Unused Public IPs
# Identify Unused Public IPs
resources
| where type == "microsoft.network/publicipaddresses"
| where isnull(properties.ipConfiguration) and isnull(properties.natGateway)
| project id, name, location, ip=properties.ipAddress
| order by ['id'] asc
Find All Resources Created/Deleted in the Last One Day
# Resource created in the last one day, by querying the resourcechanges table
resourcechanges
| extend changeTime = todatetime(properties.changeAttributes.timestamp),
targetResourceId = tostring(properties.targetResourceId),
changeType = tostring(properties.changeType),
correlationId = properties.changeAttributes.correlationId
| where changeType == "Create" // Can be "Create", "Delete" or "Update"
| where changeTime >= ago(1d)
| project changeTime, targetResourceId, changeType, correlationId
| order by changeTime desc

List the Subscriptions Containing Specific Resource Types
# Subscriptions containing Azure Databricks
resources
| where type == "microsoft.databricks/workspaces"
| summarize countBySubId=count() by subscriptionId
| sort by countBySubId desc
List Storage Accounts Set to Allow Public Access
Storage accounts that allow unrestricted public access are a common high-severity Indicator of Misconfiguration (IOM) reported by security tools.
resources
| where type =~ 'microsoft.storage/storageAccounts' // case-insensitive equals
| extend defaultAction = tostring(parse_json(properties.networkAcls).defaultAction)
| where defaultAction =~ 'allow'
| project name, resourceGroup, subscriptionId, defaultActionGet the Minimum TLS Version Configured on Storage Accounts and SQL Servers
# Storage (joining resourcecontainers to find the subscription names)
resources
| join kind=leftouter (resourcecontainers | where type=='microsoft.resources/subscriptions' | project subName=name, subscriptionId) on subscriptionId
| where type == 'microsoft.storage/storageaccounts'
| project subscriptionId, subName, resourceGroup, storage=name, minTlsVer=properties.minimumTlsVersion
| sort by subName asc, resourceGroup asc, storage asc
# SQL Server (joining resourcecontainers to find the subscription names)
resources
| join kind=leftouter (resourcecontainers | where type=='microsoft.resources/subscriptions' | project subName=name, subscriptionId) on subscriptionId
| where type == 'microsoft.sql/servers'
| project subscriptionId, subName, resourceGroup, server=name, minTlsVer=properties.minimalTlsVersion
| sort by subName asc, resourceGroup asc, server asc

Conclusion
Azure Resource Graph Explorer is an essential tool for cloud administrators who need fast, scalable insights into their Azure environments. By leveraging Kusto Query Language (KQL), you can efficiently manage resources, enhance security posture, and optimize cloud costs.
Next Steps to Try:
- Run the sample queries in Azure Resource Graph Explorer
- Explore the Azure CLI or PowerShell integrations
- Build custom dashboards in Azure Monitor using ARG data
Happy querying!
