Search code examples
azure-data-explorerkqlazure-resource-groupkusto-explorerazure-resource-graph

Azure Resource Graph Explorer :: list all resourceGroup with subscriptionName


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.


Solution

  • 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