diff --git a/docs/_docs/best-practices/general/general.md b/docs/_docs/best-practices/general/general.md index 0c009f31b..42e6e3c20 100644 --- a/docs/_docs/best-practices/general/general.md +++ b/docs/_docs/best-practices/general/general.md @@ -20,6 +20,7 @@ Discover essential FinOps best practices to optimize cost efficiency and governa
On this page +- [Resource inventory summary](#resource-inventory-summary) - [Carbon Optimization](#carbon-optimization) - [🙋‍♀️ Looking for more?](#️-looking-for-more) - [🧰 Related tools](#-related-tools) @@ -28,6 +29,157 @@ Discover essential FinOps best practices to optimize cost efficiency and governa --- +## Resource inventory summary + +### Query: Count of all resources + +This Azure Resource Graph (ARG) query counts all resources within the specified scope. + +

Category

+ +Inventory + +

Query

+ +```kql +Resources +| summarize count() +``` + +
+ +### Query: Count of all resources per subscription + +This Azure Resource Graph (ARG) query counts all resources within the specified scope per subscription. + +

Category

+ +Inventory + +

Query

+ +```kql +resources +| summarize Count=count(id) by subscriptionId +| order by Count desc +``` + +
+ +### Query: Count of all resources per type + +This Azure Resource Graph (ARG) query counts all resources within the specified scope per type. + +

Category

+ +Inventory + +

Query

+ +```kql +Resources +| extend type = case( +type contains 'microsoft.netapp/netappaccounts', 'NetApp Accounts', +type contains "microsoft.compute", "Azure Compute", +type contains "microsoft.logic", "LogicApps", +type contains 'microsoft.keyvault/vaults', "Key Vaults", +type contains 'microsoft.storage/storageaccounts', "Storage Accounts", +type contains 'microsoft.compute/availabilitysets', 'Availability Sets', +type contains 'microsoft.operationalinsights/workspaces', 'Azure Monitor Resources', +type contains 'microsoft.operationsmanagement', 'Operations Management Resources', +type contains 'microsoft.insights', 'Azure Monitor Resources', +type contains 'microsoft.desktopvirtualization/applicationgroups', 'WVD Application Groups', +type contains 'microsoft.desktopvirtualization/workspaces', 'WVD Workspaces', +type contains 'microsoft.desktopvirtualization/hostpools', 'WVD Hostpools', +type contains 'microsoft.recoveryservices/vaults', 'Backup Vaults', +type contains 'microsoft.web', 'App Services', +type contains 'microsoft.managedidentity/userassignedidentities','Managed Identities', +type contains 'microsoft.storagesync/storagesyncservices', 'Azure File Sync', +type contains 'microsoft.hybridcompute/machines', 'ARC Machines', +type contains 'Microsoft.EventHub', 'Event Hub', +type contains 'Microsoft.EventGrid', 'Event Grid', +type contains 'Microsoft.Sql', 'SQL Resources', +type contains 'Microsoft.HDInsight/clusters', 'HDInsight Clusters', +type contains 'microsoft.devtestlab', 'DevTest Labs Resources', +type contains 'microsoft.containerinstance', 'Container Instances Resources', +type contains 'microsoft.portal/dashboards', 'Azure Dashboards', +type contains 'microsoft.containerregistry/registries', 'Container Registry', +type contains 'microsoft.automation', 'Automation Resources', +type contains 'sendgrid.email/accounts', 'SendGrid Accounts', +type contains 'microsoft.datafactory/factories', 'Data Factory', +type contains 'microsoft.databricks/workspaces', 'Databricks Workspaces', +type contains 'microsoft.machinelearningservices/workspaces', 'Machine Learnings Workspaces', +type contains 'microsoft.alertsmanagement/smartdetectoralertrules', 'Azure Monitor Resources', +type contains 'microsoft.apimanagement/service', 'API Management Services', +type contains 'microsoft.dbforpostgresql', 'PostgreSQL Resources', +type contains 'microsoft.scheduler/jobcollections', 'Scheduler Job Collections', +type contains 'microsoft.visualstudio/account', 'Azure DevOps Organization', +type contains 'microsoft.network/', 'Network Resources', +type contains 'microsoft.migrate/' or type contains 'microsoft.offazure', 'Azure Migrate Resources', +type contains 'microsoft.servicebus/namespaces', 'Service Bus Namespaces', +type contains 'microsoft.classic', 'ASM Obsolete Resources', +type contains 'microsoft.resources/templatespecs', 'Template Spec Resources', +type contains 'microsoft.virtualmachineimages', 'VM Image Templates', +type contains 'microsoft.documentdb', 'CosmosDB DB Resources', +type contains 'microsoft.alertsmanagement/actionrules', 'Azure Monitor Resources', +type contains 'microsoft.kubernetes/connectedclusters', 'ARC Kubernetes Clusters', +type contains 'microsoft.purview', 'Purview Resources', +type contains 'microsoft.security', 'Security Resources', +type contains 'microsoft.cdn', 'CDN Resources', +type contains 'microsoft.devices','IoT Resources', +type contains 'microsoft.datamigration', 'Data Migraiton Services', +type contains 'microsoft.cognitiveservices', 'Congitive Services', +type contains 'microsoft.customproviders', 'Custom Providers', +type contains 'microsoft.appconfiguration', 'App Services', +type contains 'microsoft.search', 'Search Services', +type contains 'microsoft.maps', 'Maps', +type contains 'microsoft.containerservice/managedclusters', 'AKS', +type contains 'microsoft.signalrservice', 'SignalR', +type contains 'microsoft.resourcegraph/queries', 'Resource Graph Queries', +type contains 'microsoft.batch', 'MS Batch', +type contains 'microsoft.analysisservices', 'Analysis Services', +type contains 'microsoft.synapse/workspaces', 'Synapse Workspaces', +type contains 'microsoft.synapse/workspaces/sqlpools', 'Synapse SQL Pools', +type contains 'microsoft.kusto/clusters', 'ADX Clusters', +type contains 'microsoft.resources/deploymentscripts', 'Deployment Scripts', +type contains 'microsoft.aad/domainservices', 'AD Domain Services', +type contains 'microsoft.labservices/labaccounts', 'Lab Accounts', +type contains 'microsoft.automanage/accounts', 'Automanage Accounts', +type contains 'microsoft.relay/namespaces', 'Azure Relay', +type contains 'microsoft.notificationhubs/namespaces', 'Notification Hubs', +type contains 'microsoft.digitaltwins/digitaltwinsinstances', 'Digital Twins', +type contains 'microsoft.monitor/accounts', 'Monitor Accounts', +type contains 'microsoft.dashboard/grafana', 'Grafana', +type contains 'microsoft.scom/managedinstances', 'SCOM Managed instances', +type contains 'microsoft.datareplication/replicationvaults', 'Replication Vaults', +type contains 'microsoft.avs/privateclouds', 'Azure VMWare Solution', +type contains 'microsoft.machinelearningservices/registries', 'Machine learning registries', +type contains 'microsoft.dbformysql/flexibleservers', 'MySQL flexible servers', +type contains 'microsoft.dataprotection/backupvaults', 'Backup vaults', +strcat("Not Translated: ", type)) +| summarize count() by type +| order by count_ desc +``` + +
+ +### Query: Count of all resources per region + +This Azure Resource Graph (ARG) query counts all resources within the specified scope per region. + +

Category

+ +Inventory + +

Query

+ +```kql +resources +| summarize count() by location +``` + +
+ ## Carbon Optimization ### Query: Carbon emissions