Tools for migrating from Log Analytics Agent to Azure Monitor Agent

Azure Monitor Agent (AMA) replaces the Log Analytics agent (also known as MMA and OMS) for Windows and Linux machines, in Azure and non-Azure environments, including on-premises and third-party clouds. The benefits of migrating to Azure Monitor Agent include enhanced security, cost-effectiveness, performance, manageability and reliability. This article explains how to use the AMA Migration Helper and DCR Config Generator tools to help automate and track the migration from Log Analytics Agent to Azure Monitor Agent.

Flow diagram that shows the steps involved in agent migration and how the migration tools help in generating DCRs and tracking the entire migration process.

Important

Do not remove legacy agents being used by other Azure solutions or services. Use the migration helper to discover which solutions and services you use today.

Important

The legacy Log Analytics agent will be deprecated by August 2024. After this date, Microsoft will no longer provide any support for the Log Analytics agent. Migrate to Azure Monitor agent before August 2024 to continue ingesting data.

Using AMA Migration Helper

AMA Migration Helper is a workbook-based Azure Monitor solution that helps you discover what to migrate and track progress as you move from Log Analytics Agent to Azure Monitor Agent. Use this single pane of glass view to expedite and track the status of your agent migration journey. The helper now supports multiple subscriptions, and includes automatic migration recommendations based on your usage.

You can access the workbook here, or find it on the Azure portal under Monitor > Workbooks > Public Templates > Azure Monitor essentials > AMA Migration Helper.

Screenshot of the Azure Monitor Agent Migration Helper workbook. The screenshot highlights the Subscription and Workspace dropdowns and shows the Azure Virtual Machines tab, on which you can track which agent is deployed on each virtual machine.

Automatic Migration Recommendations

Screenshot of the Azure Monitor Agent Migration Helper workbook. The screenshot highlights the automatic migration recommendations based on sample usage across machines within selected scope.

Installing and using DCR Config Generator

Azure Monitor Agent relies only on data collection rules (DCRs) for configuration, whereas Log Analytics Agent inherits its configuration from Log Analytics workspaces.

Use the DCR Config Generator tool to parse Log Analytics Agent configuration from your workspaces and generate/deploy corresponding data collection rules automatically. You can then associate the rules to machines running the new agent using built-in association policies.

Note

DCR Config Generator does not currently support additional configuration for Azure solutions or services dependent on Log Analytics Agent.

Prerequisites

To install DCR Config Generator, you need:

  1. PowerShell version 5.1 or higher. We recommend using PowerShell version 7.1.3 or higher.
  2. Read access for the specified workspace resources.
  3. The Az Powershell module to pull workspace agent configuration information. Make sure Az.Accounts and Az.OperationalInsights modules are installed.
  4. The Azure credentials for running Connect-AzAccount and Select-AzContext, which set the context for the script to run.

To install DCR Config Generator:

  1. Download the PowerShell script.

  2. Run the script:

    Option 1: Outputs ready-to-deploy ARM template files only, which creates the generated DCR in the specified subscription and resource group, when deployed.

     .\WorkspaceConfigToDCRMigrationTool.ps1 -SubscriptionId $subId -ResourceGroupName $rgName -WorkspaceName $workspaceName -DCRName $dcrName -Location $location -FolderPath $folderPath
    

    Option 2: Outputs ready-to-deploy ARM template files and the DCR JSON files separately for you to deploy via other means. You need to set the GetDcrPayload parameter.

     .\WorkspaceConfigToDCRMigrationTool.ps1 -SubscriptionId $subId -ResourceGroupName $rgName -WorkspaceName $workspaceName -DCRName $dcrName -Location $location -FolderPath $folderPath -GetDcrPayload
    

    Parameters

    Parameter Required? Description
    SubscriptionId Yes ID of the subscription that contains the target workspace.
    ResourceGroupName Yes Resource group that contains the target workspace.
    WorkspaceName Yes Name of the target workspace.
    DCRName Yes Name of the new DCR.
    Location Yes Region location for the new DCR.
    GetDcrPayload No When set, it generates additional DCR JSON files
    FolderPath No Path in which to save the ARM template files and JSON files (optional). By default, Azure Monitor uses the current directory.
  3. Review the output ARM template files. The script can produce two types of ARM template files, depending on the agent configuration in the target workspace:

    • Windows ARM template and parameter files - if the target workspace contains Windows performance counters or Windows events.
    • Linux ARM template and parameter files - if the target workspace contains Linux performance counters or Linux Syslog events.

    If the Log Analytics workspace wasn't configured to collect data from connected agents, the generated files will be empty. This is a scenario in which the agent was connected to a Log Analytics workspace, but wasn't configured to send any data from the host machine.

  4. Deploy the generated ARM templates:

    1. In the portal's search box, type in template and then select Deploy a custom template.

      Screenshot of the Deploy custom template screen.

    2. Select Build your own template in the editor.

      Screenshot of the template editor.

    3. Paste the generated template into the editor and select Save.

    4. On the Custom deployment screen, specify a Subscription, Resource group, and Region.

    5. Select Review + create > Create.

    Note

    You can include up to 100 'counterSpecifiers' in a data collection rule. 'samplingFrequencyInSeconds' must be between 1 and 300, inclusive.

  5. Associate machines to your data collection rules:

    1. From the Monitor menu, select Data Collection Rules.
    2. From the Data Collection Rules screen, select your data collection rule.
    3. Select View resources > Add.
    4. Select your machines > Apply.