kqlazure-monitorazure-monitor-workbooks

Get tenant displayName using Kusto queries


I can't seem to find a way to retrieve the displayName for a tenantid using a table available in Azure Monitor.

Using Azure Resource Graph Kusto queries I query resources across tenants (Lighthouse). The resources contains a property for tenantId, but I want a way to lookup that tenantId to a name.

E.g. in the column tenantId I want that mapped up to the displayName.

Resources
| where type == "microsoft.network/virtualnetworks"
| project tenantId, id, name

Is there a way or do I end up getting that information from another place?


Solution

  • I don't believe that there is any Tenant table in ARG like resourcecontainers has subscription names.

    It looks like there are CLI extras that will do the extra lookups/mappings for you, not sure why that isn't a feature of the queries themselves?

    in workbooks, you could possibly call the ARM api to look up tenants:

    https://learn.microsoft.com/en-us/rest/api/resources/tenants/list?view=rest-resources-2022-12-01&tabs=HTTP

    and then use a workbooks Merge datasource to join in the names?