Azure 资源图查询 |获取 VM 许可权益类型

Azure Resource Graph query | get VM license benefit type

我可以从“资源 |其中 type =~ 'Microsoft.Compute/virtualMachines'" 然后展开属性。我正在寻找的是 Windows 许可证类型。相同的信息可在 "Virtual Machines" 下的门户网站上找到 - 添加列 - "OS licensing benefit"。值的类型为 "Azure hybrid benefit"、"Not enabled" 等

我可以通过 Microsoft 中的 properties.sqlServerLicenseType 为 IaaS 上的 SQL 服务器获取相同的信息。sqlvirtualmachine/sqlvirtualmachines,所以猜猜有没有办法为 VM 获取它?任何反馈将不胜感激。

这是门户检查 属性 并生成列值的简化版本(门户还显示 Linux 的 "Not supported",您可以为其添加逻辑如果需要):

resources
| where type =~ "microsoft.compute/virtualmachines"
| extend HybridBenefit = iif(properties.licenseType == "Windows_Server", "Azure Hybrid Benefit", "Not Enabled") 

This 与您在 GitHub 中的提问重复。分享,让更多人受益。