如何用Azure资源图查询缺失标签?Temporary标签是否为策略自动分配?
Azure资源图查询与标签问题解答
一、查询缺失标签的资源和资源组
以下是几个可直接在Azure Resource Graph Explorer中运行的简单查询:
1. 查询无任何标签的资源及资源组
这个查询会列出所有完全没有标签的资源和资源组:
resources | union resourcecontainers | where type in ('Microsoft.Resources/subscriptions/resourceGroups', 'microsoft.resources/resources') | where array_length(bag_keys(tags)) == 0 | project name, type, subscriptionId, resourceGroup
2. 查询缺失指定标签的资源及资源组
如果要检查特定标签(比如CostCenter)是否缺失,用这个查询,还会显示现有标签方便对比:
resources | union resourcecontainers | where type in ('Microsoft.Resources/subscriptions/resourceGroups', 'microsoft.resources/resources') | where isnull(tags.CostCenter) or tags.CostCenter == '' | project name, type, subscriptionId, resourceGroup, existingTags = tags
二、关于标签的疑问
是的,
当你配置了带“Modify”效果的标签策略,且策略里设置了默认值为
内容的提问来源于stack exchange,提问作者OllieP
相关产品推荐
相关产品推荐

