Azure Resource Graph Explorer :: list all resourceGroup with subscriptionName

937 views Asked by At

I've created a kusto query that will allow me to have an overview of all resourceGroups:

resourcecontainers
where type == 'microsoft.resources/subscriptions/resourcegroups'
project subscriptionId, resourceGroup,  tags.mytag1, tags.mytag2, tags.mytag3

Is there a way I can project the subscriptionName instead of the subscriptionId?

the goal is to make it more human readable.

1

There are 1 answers

3
Peter Bons On BEST ANSWER

Sure, that is possible by joining on the resourcecontainers of type microsoft.resources/subscriptions:

resourcecontainers
| where type == 'microsoft.resources/subscriptions' 
| project subscriptionId, subscriptionName = name 
| join (resourcecontainers 
    | where type == 'microsoft.resources/subscriptions/resourcegroups') 
    on subscriptionId 
| project subscriptionName, resourceGroup, tags.mytag1, tags.mytag2, tags.mytag3