1. はじめに
Azure VM に導入される拡張情報 (Extention) を抽出するクエリーが欲しかったので作成してみました。
2. クエリー例
Azure Resource Graph から抽出する例です。
microsoft.compute/virtualmachines
の情報に microsoft.compute/virtualmachines/extensions
を JOIN すると綺麗に抽出できます。
Resources
| where type == 'microsoft.compute/virtualmachines'
| extend
JoinID = toupper(id),
OSName = tostring(properties.osProfile.computerName),
OSType = tostring(properties.storageProfile.osDisk.osType),
VMSize = tostring(properties.hardwareProfile.vmSize)
| join kind=leftouter(
Resources
| where type == 'microsoft.compute/virtualmachines/extensions'
| extend
VMId = toupper(substring(id, 0, indexof(id, '/extensions'))),
ExtensionName = name
) on $left.JoinID == $right.VMId
| summarize Extensions = make_list(ExtensionName) by OSName, OSType,subscriptionId
| order by tolower(OSName) asc
Extensions (拡張情報)は json アレイ形式で抽出されるので、ロジックアプリを使う場合は For Each 処理で制御できます。
3. 参考情報