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.
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.
- Azure subscription. If you don't have one yet, you can activate your MSDN subscriber benefits or sign up for a free account.
- Automation account to manage machines.
- A virtual machine.
Enable Change Tracking and Inventory
In the Azure portal, select Automation Accounts, and then select your Automation account in the list.
Select Inventory under Configuration Management.
Select an existing Log Analytics workspace or create a new one.
Select Azure VM to manage
With Change Tracking and Inventory enabled, you can add an Azure VM for management by the feature.
From your Automation account, select Change tracking or Inventory under Configuration Management.
Click Add Azure VMs to add your VM.
Choose your VM from the list and click Enable. This action enables Change Tracking and Inventory for the VM.
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.
In your Automation account, select Modules under Shared Resources.
Select Update Azure Modules to update the Azure modules to the latest version.
Click Yes to update all existing Azure modules to the latest version.
Return to Modules under Shared Resources.
Select Browse gallery to open up the module gallery.
Search for Az.OperationalInsights and import this module into the Automation account.
Import a runbook to enable Change Tracking and Inventory
In your Automation account, select Runbooks under Process Automation.
Select Browse gallery.
update and change tracking.
Select the runbook and click Import on the View Source page.
Click OK to import the runbook into the Automation account.
On the Runbook page, click Edit, then select Publish.
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.
Open the Enable-MultipleSolution runbook.
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.
Select OK to start the runbook job.
Monitor progress and any errors on the runbook job page.