この記事では、Azure仮想マシン、仮想マシン スケール セット、およびAzure Arc対応サーバーにAzure Monitor エージェントをインストール、アンインストール、更新、構成する方法について説明します。
前提条件
Azure Monitor エージェントを使用するための前提条件やその他の要件については、以下の記事をご覧ください。
重要
エージェントがプライベート リンクAzure使用してLog Analytics ワークスペースに接続する場合は、「仮想マシンと Azure Monitor の Kubernetes クラスターを監視するための有効なプライベート リンク」を参照してください。
重要
Azure Monitor エージェントをインストール、アップグレード、またはアンインストールするときに、コンピューターを再起動する必要はありません。
インストール オプション
Azure VM と Azure Arc 対応サーバーに Azure Monitor エージェントをインストールするときのオプションを次の表に示します。
Azureに存在しないマシンの場合は、Azure Monitor エージェントをインストールする前に、Azure Arc エージェントをマシンにインストールする必要があります。
| インストール方法 |
説明 |
| 仮想マシン (VM) 拡張機能 |
この記事の任意の方法を使用して、Azure拡張機能フレームワークを使用してエージェントをインストールします。 このメソッドではデータ収集規則 (DCR) は作成されないため、データ収集を開始する前に少なくとも 1 つの DCR を作成し、エージェントに関連付ける必要があります。 |
|
DCR を作成する |
Azure ポータルで DCR を作成すると、Azure Monitor エージェントは、DCR のリソースとして追加されたすべてのマシンにインストールされます。 エージェントは、DCR で定義されているデータの収集を直ちに開始します。 |
|
VM の分析情報 |
マシン上で VM Insights を有効にすると、Azure Monitor エージェントがインストールされ、定義済みのデータ セットを収集するための DCR が作成されます。 この DCR は変更しないでください。ただし、より多くのデータを収集するために追加の DCR を作成することはできます。 |
|
コンテナーの分析情報 |
Kubernetes クラスターで Prometheus メトリックまたはコンテナー ログの収集を有効にすると、コンテナー化されたバージョンの Azure Monitor エージェントがクラスターにインストールされ、データの収集をすぐに開始するために DCR が作成されます。 DCR を変更するには、「DCR を使用して Container insights でデータ収集とコストの最適化を構成する」のガイダンスを使用します。 |
|
クライアント インストーラー |
Windows 11 クライアントおよび Windows 10 のクライアント用の Windows MSI インストーラーを使用してエージェントをインストールします。 |
|
Azure Policy |
Azure Policyを使用して、Azure仮想マシンとAzure Arc対応サーバーにエージェントを自動的にインストールし、必要な DCR に関連付けます。 |
注
テナント間でデータを送信するには、まず Azure Lighthouse を有効にする必要があります。
Azure Monitor エージェントがインストールされたマシンのクローンはサポートされていません。 このシナリオのベスト プラクティスは、 Azure Policy またはコードとしてのインフラストラクチャ (IaaC) ツールを使用して、Azure Monitor エージェントを大規模にデプロイすることです。
次の表は、各Azure Monitor エージェント操作で使用できるメソッドをまとめたものです。
エージェント拡張機能をインストールする
Azure ポータルを使用してAzure Monitor エージェントをインストールするには、データ収集規則 (DCR)を作成することをお勧めします。 Azure Monitor エージェントは必要に応じて自動的にインストールされ、DCR と選択した各マシンの間に関連付けが作成されます。
プラットフォームの種類の設定、リソースの追加、データ ソースの構成方法など、詳細なポータルチュートリアルについては、「 データ収集ルールの作成 (DCR)」を参照してください。
仮想マシン拡張機能を追加するための PowerShell コマンドを使用して、Azure 仮想マシンまたは Azure Arc 対応サーバーに Azure Monitor エージェントをインストールできます。
Azure仮想マシンにAzure Monitor エージェントをインストールする
次の PowerShell コマンドを使用して、Azure 仮想マシンに Azure Monitor エージェントをインストールします。 使用する認証方法に基づいて、適切なコマンドを選択します。
ウィンドウズ
## User-assigned managed identity
Set-AzVMExtension -Name AzureMonitorWindowsAgent -ExtensionType AzureMonitorWindowsAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name> -Location <location> -TypeHandlerVersion <version-number> -EnableAutomaticUpgrade $true -SettingString '{"authentication":{"managedIdentity":{"identifier-name":"mi_res_id","identifier-value":"/subscriptions/<my-subscription-id>/resourceGroups/<my-resource-group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<my-user-assigned-identity>"}}}'
## System-assigned managed identity
Set-AzVMExtension -Name AzureMonitorWindowsAgent -ExtensionType AzureMonitorWindowsAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name> -Location <location> -TypeHandlerVersion <version-number> -EnableAutomaticUpgrade $true
Linux
## User-assigned managed identity
Set-AzVMExtension -Name AzureMonitorLinuxAgent -ExtensionType AzureMonitorLinuxAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name> -Location <location> -TypeHandlerVersion <version-number> -EnableAutomaticUpgrade $true -SettingString '{"authentication":{"managedIdentity":{"identifier-name":"mi_res_id","identifier-value":"/subscriptions/<my-subscription-id>/resourceGroups/<my-resource-group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<my-user-assigned-identity>"}}}'
## System-assigned managed identity
Set-AzVMExtension -Name AzureMonitorLinuxAgent -ExtensionType AzureMonitorLinuxAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name> -Location <location> -TypeHandlerVersion <version-number> -EnableAutomaticUpgrade $true
Azure仮想マシン スケール セットにAzure Monitor エージェントをインストールする
Add-AzVmssExtension PowerShell コマンドレットを使用して、Azure Monitor エージェントを Azure 仮想マシン スケール セットにインストールします。
ウィンドウズ
$vmss = Get-AzVmss -ResourceGroupName <resource-group-name> -VMScaleSetName <vmss-name>
Add-AzVmssExtension -VirtualMachineScaleSet $vmss -Name AzureMonitorWindowsAgent -Publisher Microsoft.Azure.Monitor -Type AzureMonitorWindowsAgent -TypeHandlerVersion <version-number> -EnableAutomaticUpgrade $true
Update-AzVmss -ResourceGroupName <resource-group-name> -VMScaleSetName <vmss-name> -VirtualMachineScaleSet $vmss
Linux
$vmss = Get-AzVmss -ResourceGroupName <resource-group-name> -VMScaleSetName <vmss-name>
Add-AzVmssExtension -VirtualMachineScaleSet $vmss -Name AzureMonitorLinuxAgent -Publisher Microsoft.Azure.Monitor -Type AzureMonitorLinuxAgent -TypeHandlerVersion <version-number> -EnableAutomaticUpgrade $true
Update-AzVmss -ResourceGroupName <resource-group-name> -VMScaleSetName <vmss-name> -VirtualMachineScaleSet $vmss
注
スケール セットのアップグレード ポリシーを 手動に設定した場合は、VMSS モデルを変更した後に Update-AzVmssInstance を実行して既存のインスタンスを更新する必要があります。
自動アップグレード ポリシーまたはローリング アップグレード ポリシーを使用するスケール セットの場合、拡張機能はインスタンスに自動的に適用されます。
Azure Arc対応サーバーにAzure Monitor エージェントをインストールする
次の PowerShell コマンドを使用して、Azure Arc 対応サーバーに Azure Monitor エージェントをインストールします。
ウィンドウズ
New-AzConnectedMachineExtension -Name AzureMonitorWindowsAgent -ExtensionType AzureMonitorWindowsAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -MachineName <arc-server-name> -Location <arc-server-location> -EnableAutomaticUpgrade
Linux
New-AzConnectedMachineExtension -Name AzureMonitorLinuxAgent -ExtensionType AzureMonitorLinuxAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -MachineName <arc-server-name> -Location <arc-server-location> -EnableAutomaticUpgrade
Azure Monitor エージェントをAzure仮想マシンまたはAzure Arc対応サーバーにインストールするには、Azure CLI コマンドを使用して仮想マシン拡張機能を追加します。
Azure仮想マシンにAzure Monitor エージェントをインストールする
次の Azure CLI コマンドを使用して、Azure 仮想マシンに Azure Monitor エージェントをインストールします。 使用する認証方法に基づいて、適切なコマンドを選択します。
ユーザー割り当てマネージド ID
ウィンドウズ
az vm extension set --name AzureMonitorWindowsAgent --publisher Microsoft.Azure.Monitor --ids <vm-resource-id> --enable-auto-upgrade true --settings '{"authentication":{"managedIdentity":{"identifier-name":"mi_res_id","identifier-value":"/subscriptions/<my-subscription-id>/resourceGroups/<my-resource-group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<my-user-assigned-identity>"}}}'
Linux
az vm extension set --name AzureMonitorLinuxAgent --publisher Microsoft.Azure.Monitor --ids <vm-resource-id> --enable-auto-upgrade true --settings '{"authentication":{"managedIdentity":{"identifier-name":"mi_res_id","identifier-value":"/subscriptions/<my-subscription-id>/resourceGroups/<my-resource-group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<my-user-assigned-identity>"}}}'
システム割り当てマネージド ID
ウィンドウズ
az vm extension set --name AzureMonitorWindowsAgent --publisher Microsoft.Azure.Monitor --ids <vm-resource-id> --enable-auto-upgrade true
Linux
az vm extension set --name AzureMonitorLinuxAgent --publisher Microsoft.Azure.Monitor --ids <vm-resource-id> --enable-auto-upgrade true
Azure仮想マシン スケール セットにAzure Monitor エージェントをインストールする
az vmss 拡張機能セット Azure CLI コマンドレットを使用して、Azure仮想マシン スケール セットにAzure Monitor エージェントをインストールします。
ウィンドウズ
az vmss extension set --name AzureMonitorWindowsAgent --publisher Microsoft.Azure.Monitor --vmss-name <vmss-name> --resource-group <resource-group-name> --enable-auto-upgrade true
Linux
az vmss extension set --name AzureMonitorLinuxAgent --publisher Microsoft.Azure.Monitor --vmss-name <vmss-name> --resource-group <resource-group-name> --enable-auto-upgrade true
ユーザー割り当てマネージド ID を使用するには、 --settings パラメーターを追加します。
az vmss extension set --name AzureMonitorLinuxAgent --publisher Microsoft.Azure.Monitor --vmss-name <vmss-name> --resource-group <resource-group-name> --enable-auto-upgrade true --settings '{"authentication":{"managedIdentity":{"identifier-name":"mi_res_id","identifier-value":"/subscriptions/<my-subscription-id>/resourceGroups/<my-resource-group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<my-user-assigned-identity>"}}}'
注
スケール セットのアップグレード ポリシーを 手動に設定した場合は、 az vmss update-instances を実行して拡張機能を適用することで、既存のインスタンスを更新する必要があります。
自動アップグレード ポリシーまたはローリング アップグレード ポリシーを使用するスケール セットの場合、拡張機能はインスタンスに自動的に適用されます。
Azure Arc対応サーバーにAzure Monitor エージェントをインストールする
次の Azure CLI コマンドを使用して、Azure Arc 対応サーバーに Azure Monitor エージェントをインストールします。
ウィンドウズ
az connectedmachine extension create --name AzureMonitorWindowsAgent --publisher Microsoft.Azure.Monitor --type AzureMonitorWindowsAgent --machine-name <arc-server-name> --resource-group <resource-group-name> --location <arc-server-location> --enable-auto-upgrade true
Linux
az connectedmachine extension create --name AzureMonitorLinuxAgent --publisher Microsoft.Azure.Monitor --type AzureMonitorLinuxAgent --machine-name <arc-server-name> --resource-group <resource-group-name> --location <arc-server-location> --enable-auto-upgrade true
Azure Resource Manager テンプレートを使用すると、Azure 仮想マシンまたは Azure Arc 対応サーバーに Azure Monitor エージェントをインストールし、DCR との関連付けを作成することができます。 DCR の関連付けを作成する前に、DCR を作成する必要があります。
エージェントをインストールし、関連付けを作成するためのサンプル テンプレートを次のリソースから取得します。
次のコマンドを含む Resource Manager テンプレートのデプロイ方法を使用して、テンプレートをインストールします。
PowerShell
New-AzResourceGroupDeployment -ResourceGroupName "<resource-group-name>" -TemplateFile "<template-filename.json>" -TemplateParameterFile "<parameter-filename.json>"
Azure CLI
az deployment group create --resource-group "<resource-group-name>" --template-file "<path-to-template>" --parameters "@<parameter-filename.json>"
インストール中に作成された Linux ユーザー アカウント
Azure Monitor エージェントを Linux マシンにインストールすると、エージェントによってローカル ユーザー アカウントが作成され、そのコンポーネント サービスが安全に実行されます。 各アカウントは、専用のユーザー コンテキストで実行され、特権を分離し、サービス管理のための Linux セキュリティのベスト プラクティスに従います。
次の表に、Azure Monitor エージェントによって作成されるアカウントの一覧を示します。
| アカウント |
Purpose |
表示される場合 |
azuremonitoragent |
ログとメトリックの収集のために、Azure Monitor エージェント サービス プロセス (mdsd) を実行します。 |
エージェント拡張機能のインストール。 |
azureotelcollector |
VM から監視データ (メトリック、ログ、トレース) を収集し、それをAzure Monitorに転送する OpenTelemetry Collector コンポーネントを実行します。 |
OpenTelemetry データ収集でエージェントが有効になっている場合。 |
azuremetricsext |
メトリック拡張機能を実行します。この拡張機能では、エージェントによって出力されたメトリックが使用され、Azure Monitor メトリックに送信されます。 メトリック拡張機能は独立して動作しますが、エージェントによって起動および管理されます。 |
メトリック拡張機能がデプロイされたとき。 |
重要
これらのアカウントを削除または変更しないでください。 削除すると、エージェントが正しく機能しなくなる可能性があります。
これらのアカウントは、非対話型システム ユーザー (useradd --system --no-create-home --shell /usr/sbin/nologin) として作成されます。 各アカウントには、次のセキュリティ特性があります。
-
対話型ログインなし: ログイン シェルは
/usr/sbin/nologin に設定されているため、対話型の使用は禁止されます。
-
ロックされたパスワード: パスワードは既定でロックされています。
sudoアクセス権は付与されません。
-
ディスク上にホーム ディレクトリがない:
/etc/passwd にリストされているホーム ディレクトリ パス ( /home/azuremetricsext など) はメタデータのみです。 ディレクトリは意図的にディスク上に作成されません。
Tip
"ユーザーにホーム ディレクトリがありません" というフラグを設定するセキュリティ スキャン ツールでは、これらのアカウントを安全に許可リストに登録できます。 ホーム ディレクトリが見つからないのは仕様であり、構成の問題を示していません。
Azure Arc のユーザー アカウント
Azure Arc対応サーバーでは、Azure接続マシン エージェントとその拡張機能フレームワークは、前提条件インフラストラクチャの一部として、追加のローカル ユーザー アカウント (himds、arcproxy、arcuser) を作成します。 これらのアカウントは、Azure Monitor エージェントによって作成されません。 Arc 関連アカウントとその目的の詳細については、「Azure Connected Machine Agent の概要を参照してください。
インストールを検証する
Azure Monitor エージェントをインストールした後、エージェントが実行され、Log Analytics ワークスペースにデータが送信されていることを確認します。
Azure ポータルで拡張機能の状態を確認する
- Azure ポータルで、仮想マシンまたはAzure Arc対応サーバーに移動します。
- [ 拡張機能 + アプリケーション ] (または Arc 対応サーバーの 拡張機能 ) を選択します。
-
AzureMonitorWindowsAgent または AzureMonitorLinuxAgent が[プロビジョニングに成功しました]の状態で一覧表示されていることを確認します。
Azure CLIで拡張機能の状態を確認する
次のコマンドを実行して、インストールされている拡張機能を一覧表示し、Azure Monitor エージェント拡張機能が存在し、プロビジョニングされていることを確認します。
az vm extension list --resource-group <resource-group-name> --vm-name <virtual-machine-name> --output table
Azure Arc対応サーバーの場合は、次を使用します。
az connectedmachine extension list --resource-group <resource-group-name> --machine-name <arc-server-name> --output table
ハートビート クエリを使用してデータ収集を確認する
Log Analytics ワークスペースの Heartbeat テーブルにクエリを実行して、Azure Monitor エージェントがハートビート データを送信していることを確認します。 Log Analyticsで、次のコマンドを実行します。
Heartbeat
| where Category == "Azure Monitor Agent"
| where TimeGenerated > ago(5m)
| project Computer, TimeGenerated, Category, OSType
| order by TimeGenerated desc
クエリから結果が返された場合、Azure Monitor エージェントが正常にインストールされ、ワークスペースにデータが送信されます。
注
最初のハートビート データが表示されるまで、インストール後に数分かかる場合があります。 結果が表示されない場合は、 データ収集ルール がマシンに関連付けられていることを確認します。
アンインストール
Azure portal を使用して Azure Monitor エージェントをアンインストールするには、仮想マシン、スケール セット、または Azure Arc 対応サーバーに移動します。 [ 拡張機能 ] タブを選択し、 AzureMonitorWindowsAgent または AzureMonitorLinuxAgent を選択します。 開いたダイアログで、[アンインストール] を選択 します。
Azure仮想マシンでAzure Monitor エージェントをアンインストールする
次の PowerShell コマンドを使用して、Azure 仮想マシンで Azure Monitor エージェントをアンインストールします。
ウィンドウズ
Remove-AzVMExtension -Name AzureMonitorWindowsAgent -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name>
Linux
Remove-AzVMExtension -Name AzureMonitorLinuxAgent -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name>
Azure仮想マシン スケール セットでAzure Monitor エージェントをアンインストールする
Remove-AzVmssExtension PowerShell コマンドレットを使用して、Azure 仮想マシン スケール セット上の Azure Monitor エージェントをアンインストールします。
ウィンドウズ
$vmss = Get-AzVmss -ResourceGroupName <resource-group-name> -VMScaleSetName <vmss-name>
Remove-AzVmssExtension -VirtualMachineScaleSet $vmss -Name AzureMonitorWindowsAgent
Update-AzVmss -ResourceGroupName <resource-group-name> -VMScaleSetName <vmss-name> -VirtualMachineScaleSet $vmss
Linux
$vmss = Get-AzVmss -ResourceGroupName <resource-group-name> -VMScaleSetName <vmss-name>
Remove-AzVmssExtension -VirtualMachineScaleSet $vmss -Name AzureMonitorLinuxAgent
Update-AzVmss -ResourceGroupName <resource-group-name> -VMScaleSetName <vmss-name> -VirtualMachineScaleSet $vmss
Azure Arc対応サーバーでAzure Monitor エージェントをアンインストールする
次の PowerShell コマンドを使用して、Azure Arc 対応サーバーで Azure Monitor エージェントをアンインストールします。
ウィンドウズ
Remove-AzConnectedMachineExtension -MachineName <arc-server-name> -ResourceGroupName <resource-group-name> -Name AzureMonitorWindowsAgent
Linux
Remove-AzConnectedMachineExtension -MachineName <arc-server-name> -ResourceGroupName <resource-group-name> -Name AzureMonitorLinuxAgent
Azure仮想マシンでAzure Monitor エージェントをアンインストールする
次の Azure CLI コマンドを使用して、Azure 仮想マシンで Azure Monitor エージェントをアンインストールします。
ウィンドウズ
az vm extension delete --resource-group <resource-group-name> --vm-name <virtual-machine-name> --name AzureMonitorWindowsAgent
Linux
az vm extension delete --resource-group <resource-group-name> --vm-name <virtual-machine-name> --name AzureMonitorLinuxAgent
Azure仮想マシン スケール セットでAzure Monitor エージェントをアンインストールする
az vmss 拡張機能 delete Azure CLI コマンドレットを使用して、Azure 仮想マシン スケール セット上の Azure Monitor エージェントをアンインストールします。
ウィンドウズ
az vmss extension delete --name AzureMonitorWindowsAgent --vmss-name <vmss-name> --resource-group <resource-group-name>
Linux
az vmss extension delete --name AzureMonitorLinuxAgent --vmss-name <vmss-name> --resource-group <resource-group-name>
Azure Arc対応サーバーでAzure Monitor エージェントをアンインストールする
次の Azure CLI コマンドを使用して、Azure Arc 対応サーバーで Azure Monitor エージェントをアンインストールします。
ウィンドウズ
az connectedmachine extension delete --name AzureMonitorWindowsAgent --machine-name <arc-server-name> --resource-group <resource-group-name>
Linux
az connectedmachine extension delete --name AzureMonitorLinuxAgent --machine-name <arc-server-name> --resource-group <resource-group-name>
更新プログラム
注
常に最新バージョンのエージェントに更新するか、 拡張機能の自動アップグレードを選択します。
拡張機能の自動ロールアウトは、最新バージョンのエージェントを安全にデプロイするために、標準的な Azure デプロイのプラクティスに従います。 自動更新は、最新バージョンのロールアウトに数週間かかります。
アップグレードはバッチで発行されるため、一部の仮想マシン、スケール セット、または Azure Arc 対応サーバーが他のサーバーより先にアップグレードされることがあります。
拡張機能をすぐにアップグレードする必要がある場合は、この記事で説明されている手動の手順を使用します。 過去 1 年間にリリースされたエージェントのみがサポートされます。
エージェントを更新するには、仮想マシンまたはスケール セットに移動します。 [ 拡張機能 ] タブを選択し、エージェントを確認して、[ 更新] を選択します。
拡張機能の自動アップグレードを有効にして、エージェントの自動更新を有効にします。 仮想マシンまたはスケール セットに移動し、[ 拡張機能 ] タブを選択し、 AzureMonitorWindowsAgent または AzureMonitorLinuxAgent を選択します。 開いたダイアログで、[ 自動アップグレードを有効にする] を選択します。
Azure仮想マシンでの Azure Monitor エージェントの更新
エージェントを 1 回更新するには、この記事の説明に従って新しいバージョンをインストールします。
拡張機能の自動アップグレードをオプトインして、エージェントの 自動更新を有効にします。
次の PowerShell コマンドを使用します。
ウィンドウズ
Set-AzVMExtension -ExtensionName AzureMonitorWindowsAgent -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name> -Publisher Microsoft.Azure.Monitor -ExtensionType AzureMonitorWindowsAgent -TypeHandlerVersion <version-number> -Location <location> -EnableAutomaticUpgrade $true
Linux
Set-AzVMExtension -ExtensionName AzureMonitorLinuxAgent -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name> -Publisher Microsoft.Azure.Monitor -ExtensionType AzureMonitorLinuxAgent -TypeHandlerVersion <version-number> -Location <location> -EnableAutomaticUpgrade $true
Azure 仮想マシン スケール セット上の Azure Monitor エージェントの更新
スケール セットの 拡張機能の自動アップグレード を有効にします。 エージェントを手動で更新するには、 拡張機能を再インストールします。
注
スケール セットのアップグレード ポリシーを 手動に設定した場合は、VMSS モデルを変更した後に Update-AzVmssInstance を実行して既存のインスタンスを更新する必要があります。
自動アップグレード ポリシーまたはローリング アップグレード ポリシーを使用するスケール セットの場合、拡張機能はインスタンスに自動的に適用されます。
Azure Arc対応サーバーでの Azure Monitor エージェントの更新
エージェントを 1 回アップグレードするには、次の PowerShell コマンドを使用します。
ウィンドウズ
$target = @{"Microsoft.Azure.Monitor.AzureMonitorWindowsAgent" = @{"targetVersion"=<target-version-number>}}
Update-AzConnectedExtension -ResourceGroupName $env.ResourceGroupName -MachineName <arc-server-name> -ExtensionTarget $target
Linux
$target = @{"Microsoft.Azure.Monitor.AzureMonitorLinuxAgent" = @{"targetVersion"=<target-version-number>}}
Update-AzConnectedExtension -ResourceGroupName $env.ResourceGroupName -MachineName <arc-server-name> -ExtensionTarget $target
拡張機能の自動アップグレードをオプトインして、エージェントの 自動更新を有効にします。
次の PowerShell コマンドを使用します。
ウィンドウズ
Update-AzConnectedMachineExtension -ResourceGroup <resource-group-name> -MachineName <arc-server-name> -Name AzureMonitorWindowsAgent -EnableAutomaticUpgrade
Linux
Update-AzConnectedMachineExtension -ResourceGroup <resource-group-name> -MachineName <arc-server-name> -Name AzureMonitorLinuxAgent -EnableAutomaticUpgrade
Azure仮想マシンでの Azure Monitor エージェントの更新
エージェントを 1 回更新するには、まず既存のエージェント バージョンをアンインストールします。 次に、この記事の説明に従って新しいバージョンをインストールします。
次のAzure CLI コマンドを使用して、automatic extension upgrade 機能にオプトインして、エージェントの自動更新を有効にします。
ウィンドウズ
az vm extension set --name AzureMonitorWindowsAgent --publisher Microsoft.Azure.Monitor --vm-name <virtual-machine-name> --resource-group <resource-group-name> --enable-auto-upgrade true
Linux
az vm extension set --name AzureMonitorLinuxAgent --publisher Microsoft.Azure.Monitor --vm-name <virtual-machine-name> --resource-group <resource-group-name> --enable-auto-upgrade true
Azure 仮想マシン スケール セット上の Azure Monitor エージェントの更新
スケール セットの 拡張機能の自動アップグレード を有効にします。 エージェントを手動で更新するには、 拡張機能を再インストールします。
注
スケール セットのアップグレード ポリシーを 手動に設定した場合は、 az vmss update-instances を実行して拡張機能を適用することで、既存のインスタンスを更新する必要があります。
自動アップグレード ポリシーまたはローリング アップグレード ポリシーを使用するスケール セットの場合、拡張機能はインスタンスに自動的に適用されます。
Azure Arc対応サーバーでの Azure Monitor エージェントの更新
エージェントを 1 回アップグレードするには、次のAzure CLIコマンドを使用します。
ウィンドウズ
az connectedmachine upgrade-extension --extension-targets "{\"Microsoft.Azure.Monitor.AzureMonitorWindowsAgent\":{\"targetVersion\":\"<target-version-number>\"}}" --machine-name <arc-server-name> --resource-group <resource-group-name>
Linux
az connectedmachine upgrade-extension --extension-targets "{\"Microsoft.Azure.Monitor.AzureMonitorLinuxAgent\":{\"targetVersion\":\"<target-version-number>\"}}" --machine-name <arc-server-name> --resource-group <resource-group-name>
拡張機能の自動アップグレードをオプトインして、エージェントの 自動更新を有効にします。
以下の Azure CLI コマンドを使用します。
ウィンドウズ
az connectedmachine extension update --name AzureMonitorWindowsAgent --machine-name <arc-server-name> --resource-group <resource-group-name> --enable-auto-upgrade true
Linux
az connectedmachine extension update --name AzureMonitorLinuxAgent --machine-name <arc-server-name> --resource-group <resource-group-name> --enable-auto-upgrade true
AgentSettings データ収集規則 (DCR) を使用して、監視のニーズに合わせて、ローカル キャッシュ ディスク クォータなどの Azure Monitor Agent のパラメーターを構成します。 AgentSettings DCR を作成して関連付けるサポートされているパラメーターと手順については、「エージェント設定を使用したエージェントの構成」Azure Monitor参照してください。
関連コンテンツ
エージェントからデータを収集して Azure Monitor に送信するデータ収集ルールを作成します。