如何从Azure Resource Graph Explorer获取Azure Advisor各项评分?
获取Azure成本、可靠性、运营卓越性及性能总分的KQL查询方案
需求说明
- 需获取Azure中成本、可靠性、运营卓越性、性能四项的总分
- 已掌握安全评分的KQL查询方式,希望通过同类Kusto查询实现,避免调用Advisor REST API
对应KQL查询示例
1. 按类别分别获取各维度得分
AdvisorResources | where type == 'microsoft.advisor/scores' | where subscriptionId == "MY-SUBSCRIPTION-ID" | extend scoreDetails = properties.scoreDetails | mv-expand scoreDetails | project 类别 = case( scoreDetails.category == 'Cost', '成本', scoreDetails.category == 'Reliability', '可靠性', scoreDetails.category == 'OperationalExcellence', '运营卓越性', scoreDetails.category == 'Performance', '性能', scoreDetails.category ), 百分比得分 = scoreDetails.score.percentage
2. 获取四项维度的综合总分
AdvisorResources | where type == 'microsoft.advisor/scores' | where subscriptionId == "MY-SUBSCRIPTION-ID" | extend scoreDetails = properties.scoreDetails | mv-expand scoreDetails | where scoreDetails.category in ('Cost', 'Reliability', 'OperationalExcellence', 'Performance') | summarize 综合总分 = avg(scoreDetails.score.percentage)
说明
- 数据来自
AdvisorResources表,对应Azure Advisor的评分数据 - 内部类别使用英文标识,已在查询中映射为中文显示
- 替换
MY-SUBSCRIPTION-ID为你的目标订阅ID即可执行
内容的提问来源于stack exchange,提问作者Simon K
相关产品推荐
相关产品推荐

