LoginSignup
0
0

Azure VM の拡張機能 (Extention) をクエリーで抽出する

Posted at

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 処理で制御できます。

image.png

image.png

3. 参考情報

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0