Today I wanted to quickly see how many Azure clusters there are in an azure environment, their node size and count.
Azure Resource Graph
Azure Resource Graph is a service in Azure that is designed to extend Azure Resource Management by providing efficient and performant resource exploration with the ability to query at scale across a given set of subscriptions so that you can effectively govern your environment. -- https://docs.microsoft.com/en-us/azure/governance/resource-graph/overview
If you are not familiar with Azure Resource Graph - the documentation is great. It took a couple of attempts and a little bit of fiddling, but with the following query gives you all the clusters you have access to and their corresponding size:
Resources | where type == "microsoft.containerservice/managedclusters" | extend properties.agentPoolProfiles | project subscriptionId, name, pool = (properties.agentPoolProfiles) | mv-expand pool | project subscription = subscriptionId, cluster = name, size = pool.vmSize, count = pool.['count']
and the result is the following table:
Can be directly executed with the following link.
The ‘escaping’ of the .count took me a while to figure out.
Hope it helps,