Kusto获取资源组和订阅信息。

huangapple go评论57阅读模式
英文:

Kusto get resourcegroups and subscription information

问题

如何获取所有资源组的资源组名称、订阅名称和ID?

我可以使用以下方式获取所有资源组:

Resources| distinct resourceGroup

但如果我在其中添加"id",我会多次获得相同的资源组。

Resources | distinct resourceGroup, id

英文:

How can I get resource group name, subscription name and id for all the resource groups?

I can get all resourcegroups with

Resources| distinct resourceGroup

But if I add "id" in there I get same resourcegroup multiple times.

Resources | distinct resourceGroup, id

答案1

得分: 1

我明白了,您想使用资源图探索器提取订阅名称、资源组名称和ID。您可以使用以下的KQL查询:

resourcecontainers 
| where type == "microsoft.resources/subscriptions" 
| join ( resourcecontainers | where type == "microsoft.resources/subscriptions/resourcegroups") on subscriptionId 
| distinct name,name1,id1 
| project SubscriptionName=name,resourceGroupName=name1, resourceGroupId=id1

注意:这是您提供的代码段的翻译。

英文:

I understand, you want to pull the subscription Name, resource group name, id using the resource graph explorer. you can use the below KQL query.

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->

resourcecontainers 
| where type == &quot;microsoft.resources/subscriptions&quot; 
| join ( resourcecontainers | where type == &quot;microsoft.resources/subscriptions/resourcegroups&quot;) on subscriptionId 
| distinct name,name1,id1 
| project SubscriptionName=name,resourceGroupName=name1, resourceGroupId=id1

huangapple
  • 本文由 发表于 2023年6月26日 18:19:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/76555749.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定