Enable VM insights using Resource Manager templates
This article describes how to enable VM insights for a virtual machine or Virtual Machine Scale Set using Resource Manager templates. This procedure can be used for:
- Azure virtual machines
- Azure Virtual Machine Scale Sets
- Hybrid virtual machines connected with Azure Arc
If you aren't familiar with how to deploy a Resource Manager template, see Deploy templates.
Prerequisites
- See Supported operating systems to ensure that the operating system of the virtual machine or Virtual Machine Scale Set you're enabling is supported.
- See Manage the Azure Monitor agent for prerequisites related to Azure Monitor agent.
- To enable network isolation for Azure Monitor Agent, see Enable network isolation for Azure Monitor Agent by using Private Link.
Resource Manager templates
Use the Azure Resource Manager templates provided in this article to onboard virtual machines and Virtual Machine Scale Sets using Azure Monitor agent. The templates install the required agents and perform the configuration required to onboard to machine to VM insights.
Note
Deploy the template in the same resource group as the virtual machine or virtual machine scale set being enabled.
Enable VM insights using Azure Monitor Agent
First deploy the data collection rule, and then install agents to use that data collection rule.
Deploy data collection rule
This step installs a data collection rule, named MSVMI-{WorkspaceName}
, in the same resource group as your Log Analytics workspace:
Download the VM insights data collection rule templates.
Deploy a template from the downloaded zip file. The following table describes the templates available:
Folder File Description DeployDcr\
PerfAndMapDcrDeployDcrTemplate
DeployDcrParametersEnable both Performance and Map experience of VM Insights. DeployDcr\
PerfOnlyDcrDeployDcrTemplate
DeployDcrParametersEnable only Performance experience of VM Insights.
Deploy agents to machines
After you create the data collection rule, deploy:
- Azure Monitor Agent for Linux or Windows.
- Dependency agent for Linux or Dependency agent or Windows if you want to enable the Map feature.
Note
If your virtual machines scale sets have an upgrade policy set to manual, VM insights will not be enabled for instances by default after installing the template. You must manually upgrade the instances.
Deploy templates
Each folder in the download has a template and a parameters file. Modify the parameters file with required details such as Virtual Machine Resource ID, Workspace resource ID, data collection rule resource ID, Location, and OS Type. Don't modify the template file unless you need to customize it for your particular scenario.
Deploy with the Azure portal
See Quickstart: Create and deploy ARM templates by using the Azure portal for details on deploying a template from the Azure portal.
Deploy with PowerShell
Use the following command to deploy the template with PowerShell.
New-AzResourceGroupDeployment -Name OnboardCluster -ResourceGroupName <ResourceGroupName> -TemplateFile <Template.json> -TemplateParameterFile <Parameters.json>
Azure CLI
Use the following command to deploy the template with Azure CLI.
az login
az account set --subscription "Subscription Name"
az deployment group create --resource-group <ResourceGroupName> --template-file <Template.json> --parameters <Parameters.json>
Next steps
Now that monitoring is enabled for your virtual machines, this information is available for analysis with VM insights.
To view discovered application dependencies, see View VM insights Map.
To identify bottlenecks and overall utilization with your VM's performance, see View Azure VM Performance.