azureazure-virtual-machineazure-monitoringazure-monitor

How to enable AzureMonitorAgent (AMA) on Azure VM


While trying to install the AzureMonitorAgent (AMA) following docs, I am getting below error.

enter image description here

How to install the AMA from the VM extensions menu from Azure Portal?


Solution

  • How to enable AzureMonitorAgent (AMA) on Azure VM

    You can add the VM to the Data collection rule to install the Extension and enable system identity in the VM or you can install the AzureMonitorWindowsAgent manually using PowerShell to enable Logs on an Azure VM

    1. Install the AzureMonitorWindowsAgent extension on an Azure VM using PowerShell.
    Set-AzVMExtension -Name AzureMonitorWindowsAgent -ExtensionType AzureMonitorWindowsAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <RG-Name>-VMName <vmname> -Location "West Europe" -TypeHandlerVersion "1.1" -EnableAutomaticUpgrade $true
    

    Result:

    enter image description here

    1. Add the Azure VM to the Data collection rule by following these steps.

    Go to Monitor > Data Collection Rules > Create.

    enter image description here

    1. Add the VMs to the Data Collection rule on resource tab

    enter image description here

    1. Add data sources and destination as below

    enter image description here

    Destination

    enter image description here

    1. Once the complete all the steps the VM is reporting to the log analytics workspaces configured in the DCR as below.

    enter image description here