Provides examples of how to query Azure Resources with Kusto Query Language
Returns count of all Azure Resources
Resources | summarize count()
Returns count of Subscriptions and Resource Groups
resourcecontainers
| where type has "microsoft.resources/subscriptions/resourcegroups"
| summarize Count=count(type) by type, subscriptionId
| extend type = replace(@"microsoft.resources/subscriptions/resourcegroups", @"Resource Groups", type)
While everything is technically a resource in Azure. Counting VM extensions and Disks for an overview seems counter productive, thus I exclude a few items from being captured in this query.
Resources
| where type != 'microsoft.compute/disks'
| where type != 'microsoft.compute/virtualmachines/extensions'
| where type !has 'microsoft.insights'
| where type != 'microsoft.operationsmanagement/solutions'
| where type != 'microsoft.compute/images'
| where type != 'microsoft.netapp/netappaccounts/capacitypools/volumes'
| extend type = case(
type =~ 'microsoft.automation/automationaccounts', 'Automation Accounts',
type =~ 'microsoft.operationalinsights/workspaces', 'Log Analytics Workspaces',
type =~ 'microsoft.netapp/netappaccounts', 'NetApp Accounts',
type == 'microsoft.web/serverfarms', "App Service Plans",
type == 'microsoft.web/sites', "App Services",
type =~ "microsoft.compute/virtualmachines", "Azure Compute",
type =~ "microsoft.logic/workflows", "LogicApps",
type =~ 'microsoft.keyvault/vaults', "Key Vaults",
type =~ 'microsoft.keyvault/vaults', "Hybrid Compute",
type =~ 'microsoft.storage/storageaccounts', "Storage Accounts",
type =~ 'microsoft.compute/availabilitysets', 'Availability Sets',
type =~ 'microsoft.insights/components','Application Insights',
type =~ 'microsoft.desktopvirtualization/applicationgroups', 'WVD Application Groups',
type =~ 'microsoft.desktopvirtualization/workspaces', 'WVD Workspaces',
type =~ 'microsoft.desktopvirtualization/hostpools', 'WVD Hostpools',
type =~ 'microsoft.recoveryservices/vaults', 'Backup Vaults',
type =~ 'microsoft.insights/webtests', 'URL Web Tests',
type =~ 'microsoft.web/connections', 'LogicApp Connectors',
type =~ 'microsoft.web/customapis','LogicApp API Connectors',
type =~ 'microsoft.managedidentity/userassignedidentities','Managed Identities',
type =~ 'microsoft.storagesync/storagesyncservices', 'Azure File Sync',
type =~ 'microsoft.hybridcompute/machines', 'ARC Machines',
type has 'microsoft.network', 'Network Resources',
strcat("Not Translated: ", type))
| summarize count() by type
| where type !has "Not Translated"