Enable Change Tracking and Inventory from a runbook

This article describes how you can use a runbook to enable the Change Tracking and Inventory feature for VMs in your environment. To enable Azure VMs at scale, you must enable an existing VM using Change Tracking and Inventory.

Note

When enabling Change Tracking and Inventory, only certain regions are supported for linking a Log Analytics workspace and an Automation account. For a list of the supported mapping pairs, see Region mapping for Automation account and Log Analytics workspace.

Prerequisites

Enable Change Tracking and Inventory

  1. In the Azure portal, select Automation Accounts, and then select your Automation account in the list.

  2. Select Inventory under Configuration Management.

  3. Select an existing Log Analytics workspace or create a new one.

  4. Click Enable.

    Enable Change Tracking and Inventory

Select Azure VM to manage

With Change Tracking and Inventory enabled, you can add an Azure VM for management by the feature.

  1. From your Automation account, select Change tracking or Inventory under Configuration Management.

  2. Click Add Azure VMs to add your VM.

  3. Choose your VM from the list and click Enable. This action enables Change Tracking and Inventory for the VM.

    Enable Change Tracking and Inventory for VM

    Note

    If you try to enable another feature before setup of Change Tracking and Inventory has completed, you receive this message: Installation of another solution is in progress on this or a different virtual machine. When that installation completes the Enable button is enabled, and you can request installation of the solution on this virtual machine.

Install and update modules

It's required to update to the latest Azure modules and import the Az.OperationalInsights module to successfully enable Change Tracking and Inventory for your VM.

  1. In your Automation account, select Modules under Shared Resources.

  2. Select Update Azure Modules to update the Azure modules to the latest version.

  3. Click Yes to update all existing Azure modules to the latest version.

    Update modules

  4. Return to Modules under Shared Resources.

  5. Select Browse gallery to open up the module gallery.

  6. Search for Az.OperationalInsights and import this module into the Automation account.

    Import OperationalInsights module

Import a runbook to enable Change Tracking and Inventory

  1. In your Automation account, select Runbooks under Process Automation.

  2. Select Browse gallery.

  3. Search for update and change tracking.

  4. Select the runbook and click Import on the View Source page.

  5. Click OK to import the runbook into the Automation account.

    Import runbook for setup

  6. On the Runbook page, click Edit, then select Publish.

  7. On the Publish Runbook pane, click Yes to publish the runbook.

Start the runbook

You must have enabled Change Tracking and Inventory for an Azure VM to start this runbook. It requires an existing VM and resource group with the feature enabled for parameters.

  1. Open the Enable-MultipleSolution runbook.

    Multiple solution runbooks

  2. Click the start button and enter parameter values in the following fields:

    • VMNAME - The name of an existing VM to add to Change Tracking and Inventory. Leave this field blank to add all VMs in the resource group.
    • VMRESOURCEGROUP - The name of the resource group for the VMs to enable.
    • SUBSCRIPTIONID - The subscription ID of the new VM to enable. Leave this field blank to use the subscription of the workspace. When you use a different subscription ID, add the Run As account for your Automation account as a contributor for the subscription.
    • ALREADYONBOARDEDVM - The name of the VM that is already manually enabled for changes.
    • ALREADYONBOARDEDVMRESOURCEGROUP - The name of the resource group to which the VM belongs.
    • SOLUTIONTYPE - Enter ChangeTracking.

    Enable-MultipleSolution runbook parameters

  3. Select OK to start the runbook job.

  4. Monitor progress and any errors on the runbook job page.

Next steps