Configure Log Analytics workspace for VM insights

VM insights collects its data from one or more Log Analytics workspaces in Azure Monitor. Prior to onboarding agents, you must create and configure a workspace. This article describes the requirements of the workspace and to configure it for VM insights.

Important

Configuration of the Log Analytics workspace is only required for using VM insights with virtual machines using Log Analytics agent. Virtual machines using Azure Monitor agent do not use the VMInsights solution that's installed in this configuration. To support Azure Monitor agent, a standard Log Analytics workspace just needs be created as described in Create Log Analytics workspace.

Overview

A single subscription can use any number of workspaces depending on your requirements. The only requirement of the workspace is that it be located in a supported location and be configured with the VMInsights solution.

Once the workspace has been configured, you can use any of the available options to install the required agents on virtual machine and virtual machine scale set and specify a workspace for them to send their data. VM insights will collect data from any configured workspace in its subscription.

Note

When you enable VM insights on a single virtual machine or virtual machine scale set using the Azure portal, you're given the option to select an existing workspace or create a new one. The VMInsights solution will be installed in this workspace if it isn't already. You can then use this workspace for other agents.

Create Log Analytics workspace

Note

The information described in this section is also applicable to the Service Map solution.

Access Log Analytics workspaces in the Azure portal from the Log Analytics workspaces menu.

Log Anlytics workspaces

You can create a new Log Analytics workspace using any of the following methods. See Design a Log Analytics workspace configuration for guidance on determining the number of workspaces you should use in your environment and how to design their access strategy.

Supported regions

VM insights supports a Log Analytics workspace in any of the regions supported by Log Analytics.

Note

You can monitor Azure VMs in any region. The VMs themselves aren't limited to the regions supported by the Log Analytics workspace.

Azure role-based access control

To enable and access the features in VM insights, you must have the Log Analytics contributor role in the workspace. To view performance, health, and map data, you must have the monitoring reader role for the Azure VM. For more information about how to control access to a Log Analytics workspace, see Manage workspaces.

Add VMInsights solution to workspace

Before a Log Analytics workspace can be used with VM insights, it must have the VMInsights solution installed. The methods for configuring the workspace are described in the following sections.

Note

When you add the VMInsights solution to the workspace, all existing virtual machines connected to the workspace will start to send data to InsightsMetrics. Data for the other data types won't be collected until you add the Dependency Agent to those existing virtual machines connected to the workspace.

Azure portal

There are three options for configuring an existing workspace using the Azure portal. Each is described below.

To configure a single workspace, go the Virtual Machines option in the Azure Monitor menu, select the Other onboarding options, and then Configure a workspace. Select a subscription and a workspace and then click Configure.

Configure workspace

To configure multiple workspaces, select the Workspace configuration tab in the Virtual Machines menu in the Monitor menu in the Azure portal. Set the filter values to display a list of existing workspaces. Select the box next to each workspace to enable and then click Configure selected.

Workspace configuration

When you enable VM insights on a single virtual machine or virtual machine scale set using the Azure portal, you're given the option to select an existing workspace or create a new one. The VMInsights solution will be installed in this workspace if it isn't already. You can then use this workspace for other agents.

Enable single VM in portal

Resource Manager template

The Azure Resource Manager templates for VM insights are provided in an archive file (.zip) that you can download from our GitHub repo. This includes a template called ConfigureWorkspace that configures a Log Analytics workspace for VM insights. You deploy this template using any of the standard methods including the sample PowerShell and CLI commands below:

az deployment group create --name ConfigureWorkspace --resource-group my-resource-group --template-file CreateWorkspace.json  --parameters workspaceResourceId='/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group/providers/microsoft.operationalinsights/workspaces/my-workspace' workspaceLocation='eastus'

Remove VMInsights solution from workspace

If you have completely migrated your virtual machines to Azure Monitor agent and no longer want to support virtual machines with the Log Analytics agent in your workspace, then you should remove the VMInisghts solution from the workspace. This will ensure that you don't collect data from any Log Analytics agents that inadvertently remain.

To remove the VMInsightssolution, use the same process as removing any other solution from a workspace.

  1. Select the Solutions menu in the Azure portal.
  2. Locate the VMInsights solution for your workspace and select it to view its detail.
  3. Click Delete

Screenshot of delete a solution dialog box.

Next steps