Microsoft Azure – Get Management Groups Information Using KQL
Last Updated :
31 Mar, 2023
In this article, you will get to know how you can get information about azure management groups using the azure resource graph queries in a faster and simple way. Run all the below following KQL queries in Azure Resource Graph Explorer from Azure Portal to get the results. You can also export the data by clicking on Download as CSV from the Results section. The user should have read access to the management group subscriptions to fetch the data.
Use the following KQL query for the information on management group details.
Query:
ResourceContainers
| where type =~ 'microsoft.management/managementgroups'
Output:
Use the following KQL query to get the count of Management Groups in Azure Active Directory.
Query:
ResourceContainers
| where type =~ 'microsoft.management/managementgroups'
| count
Output:
Use the following KQL query to get the Azure Management Group information with the Management Group Name and its properties.
Query:
ResourceContainers
| where type =~ 'microsoft.management/managementgroups'
| project name,properties
Output:
Use the below KQL query to get the count of azure subscriptions under each management group.
Query:
ResourceContainers
| where type =~ 'microsoft.management/managementgroups'
| project mgname = name
| join kind=leftouter (resourcecontainers
| where type=~ 'microsoft.resources/subscriptions'
| extend mgParent = properties.managementGroupAncestorsChain
| project id, mgname = tostring(mgParent[0].name)) on mgname
| summarize count() by mgname
Output:
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...