normalian blog

Let's talk about Microsoft Azure, ASP.NET and Java!

Microsoft Azure の拡張機能やエージェントのバージョンに関する Tips

最近あった質問の中で、仮想マシンのエージェントや拡張等々のバージョンについて質問されたことがあったのですが、どれがどのバージョンかというのがかなり分かりにくかったのでブログにまとめたいと思います。ことの発端となったのは以下のスクリーンショットで「Azure Agent はどこ?」や「Azure Site Recovery Agent のバージョンはどこで確認するのか?」といった質問が来たからです。

特にオチ等はありませんが、言われてみればこの辺りはややこしいので Tips としてブログにまとめておいた方が良かろうと思ってこちらにまとめておきます。

Azure VM Agent のバージョンはどこ?

これについては仮想マシンの Extensions + applications メニューには存在しません。Azure Agent のバージョンは以下の様に Properties メニューから確認できます。以下の様に WindowsLinux ではバージョンが異なることがわかります。

Linux でも同様のことが可能ですが、Windows の場合なら以下の様にエクスプローラーから開いて Azure Agent の実態があるフォルダにアクセスることが可能です。C:\WindowsAzure\ 配下に Azure Agent の各バージョンが配置されているのが分かると思います。

Extensions + applications メニューのバージョンって何?

これが一番分かりにくいところかなと思っていますが、ここで表示されるバージョンは typeHandlerVersion と呼ばれる「スクリプトとして実行されるVM 拡張部分のみ
(Azure VM agent 等の実態のエージェントとは別)」のバージョンになります。
learn.microsoft.com
VM 拡張の実態は各種スクリプトを動作させるもの(Azure Monitor Agent の実態をインストールする等)になりますが、そちらのバージョンを表しています。例として Azure Site Recovery を取り上げますが、以下のコマンドを利用することで ASR の VM 拡張バージョン(!= ASR 等のエージェントのバージョン)の確認が可能です。

PS C:\Users\daisami> az vm get-instance-view --resource-group rg-name --name vmname --query "instanceView.extensions[] | [?type=='Microsoft.Azure.RecoveryServices.SiteRecovery.Windows']"
[
  {
    "name": "SiteRecovery-Windows",
    "statuses": [
      {
        "code": "ProvisioningState/succeeded",
        "displayStatus": "Provisioning succeeded",
        "level": "Info",
        "message": "Installation and configuration succeeded.",
        "time": null
      }
    ],
    "substatuses": [
      {
        "code": "ComponentStatus/{\"unique_id\":\"0d4f05d6-4960-4157-80ef-00ade88ffb01\",\"start_time_utc\":638125298878808978,\"end_time_utc\":6381252994438287
68,\"os_identifier\":\"Windows Server 2019 Datacenter\",\"os_version\":\"10.0.17763\",\"azure_guest_agent_version\":\"2.7.41491.1071\",\"python_version\":null,\
"kernel_version\":null,\"available_physical_memory\":4680007680}/succeeded",
        "displayStatus": "Provisioning succeeded",
        "level": "Info",
        "message": null,
        "time": null
      },
      {
        "code": "ComponentStatus/taskid:7849f91b-2ea6-4bd7-894a-f7a7b086fbc3/succeeded",
        "displayStatus": "Provisioning succeeded",
        "level": "Info",
        "message": null,
        "time": null
      }
    ],
    "type": "Microsoft.Azure.RecoveryServices.SiteRecovery.Windows",
    "typeHandlerVersion": "1.0.0.9202"
  }
]

Azure Site Recovery Agent のバージョンは?

上記で ASR 拡張のバージョンは分かりましたが、VM にインストールされる Agent のバージョンはどこで確認したら良いのでしょうか?ASR は実態のエージェントとして、以下の Mobility Agent と呼ばれるものをインストールします。
learn.microsoft.com

こちらのバージョンを確認する一番簡単な方法は Recovery Service Vault の Replication Item から以下の様に確認する方法です。

実際のバイナリ等は C:\Program Files (x86)\Microsoft Azure Site Recovery\agent に配置されます。


ここで注意が必要な点として C:\WindowsAzure\Logs\Plugins 以下に以下の様な Extensions + applications メニューに表示されているものが並んでいる点です。こちらにはエージェントのバイナリ等は配置されておらず、VM 拡張を有効化する際に実行されるスクリプトの実行ログが格納されています(フォルダパスに Logs とあるので推察する方もいると思いますが)。
ログの一部を抜粋しますが、以下の様なコマンド実行内容が出力されており、VM 拡張を有効化する際の詳細処理が確認可能です。

[2023-03-26T08:17:21.750Z] Executing: C:\Packages\Plugins\Microsoft.Azure.RecoveryServices.SiteRecovery.Windows\1.0.0.9202\Scripts\enable.cmd  
[2023-03-26T08:17:24.512Z] Execution Complete.
######
Execution Output:
C:\Packages\Plugins\Microsoft.Azure.RecoveryServices.SiteRecovery.Windows\1.0.0.9202>start /B cmd /C AzureReplicationVmExtension.exe "enable" 
2023-03-26T08:17:25.2774571Z	[Information]:	----------------VM Extension run started----------------
2023-03-26T08:17:25.2774571Z	[Warning]:	Skip the logging due to absence of the log blob URI: .
2023-03-26T08:17:25.2774571Z	[Information]:	Operating system identifier: Windows Server 2019 Datacenter. Operating system version: 10.0.17763. Azure guest agent version: 2.7.41491.1075.
2023-03-26T08:17:25.2774571Z	[Warning]:	Skip the logging due to absence of the log blob URI: .
2023-03-26T08:17:25.2824569Z	[Information]:	Bcdr Handler Initialized SiteRecoveryExtensionProd.
2023-03-26T08:17:25.2824569Z	[Warning]:	Skip the logging due to absence of the log blob URI: .
2023-03-26T08:17:25.2824569Z	[Information]:	Initializing configuration helper.
2023-03-26T08:17:25.2824569Z	[Warning]:	Skip the logging due to absence of the log blob URI: .
2023-03-26T08:17:25.2874560Z	[Information]:	Configuration file count: 1 and files are C:\Packages\Plugins\Microsoft.Azure.RecoveryServices.SiteRecovery.Windows\1.0.0.9202\RuntimeSettings\0.settings
2023-03-26T08:17:25.2874560Z	[Warning]:	Skip the logging due to absence of the log blob URI: .
2023-03-26T08:17:25.2874560Z	[Information]:	GetEnvironmentVariables: 
2023-03-26T08:17:25.2874560Z	[Warning]:	Skip the logging due to absence of the log blob URI: .
2023-03-26T08:17:25.2874560Z	[Information]:	  COMPUTERNAME = Win2019Gen2VM01
2023-03-26T08:17:25.2874560Z	[Warning]:	Skip the logging due to absence of the log blob URI: .