Exercise - Set up a Log Analytics workspace and Azure Monitor VM Insights
From the previous unit, recall that you need to explore Azure native monitoring tools for your company. To further your knowledge, you'll need to know how to provision a Log Analytics workspace with the right permissions model. Then, you'll configure Azure Monitor VM Insights to complete the process.
In this unit, you'll:
- Create a Log Analytics workspace.
- Configure the Log Analytics workspace permissions model for the environment you're supporting.
- Create two virtual machines and onboard both to Azure Monitor VM Insights.
Create and configure a Log Analytics workspace
Sign in to the Azure portal with the same account you used to activate the sandbox.
In the Search bar, search for and select Log Analytics Workspaces.
Select the Create button in the toolbar.
Enter the following values to build the Log Analytics workspace. For the Log Analytics workspace name, we suggest that you use your initials and numbers. For this module, we'll use the name xxxx-log-analytics.
Property Value Subscription Concierge Subscription Resource group [sandbox resource group name] Name xxxx-log-analytics Region Select the region closest to you. Select Review + Create, then select Create.
After the resource deploys, select Go to resource.
In the left menu, select Properties under Settings.
Look for the access control mode and ensure it's set to Use resource or workspace permissions. This setting changes the access mode to use the resource-context.
Set up your environment
Run the following command in Azure Cloud Shell:
az vm create \ --resource-group <rgn>[sandbox resource group name]</rgn> \ --location westus \ --name SampleVM1 \ --image UbuntuLTS \ --admin-username azureuser \ --generate-ssh-keys \ --verbose
After SampleVM1 finishes, run the following command in Azure Cloud Shell:
az vm create \ --resource-group <rgn>[sandbox resource group name]</rgn> \ --location westus \ --name SampleVM2 \ --image UbuntuLTS \ --admin-username azureuser \ --generate-ssh-keys \ --verbose
Onboard virtual machines to Azure Monitor VM Insights
In the Azure portal, search for and select Virtual machines.
Select SampleVM1.
In the left menu under Monitoring, select Insights, then select the Enable button.
Select the radio button for Log Analytics agent, then select the Log Analytics workspace you created in the Log Analytics workspaces drop-down.
Select Configure.
Repeat the same steps for SampleVM2.
Wait 5 to 10 minutes.
In the left menu under Monitoring > Insights, select Refresh until you get results.
Select the Map tab to review the map, which displays dependencies like processes running, ports open, connection details, health of the virtual machine, machine properties, and Azure virtual machine properties.
Select the Performance tab.
Explore the different graphs for:
- Logical Disk Performance
- CPU Utilization
- Available Memory
- Logical Disk IOPS
- Logical Disk MB/s
- Logical Disk Latency (ms)
- Max Logical Disk Used %
- Bytes Sent Rate
- Bytes Received Rate
Experiment with different settings by moving from Avg, to Min, to Max, and so on. The virtual machines were created only a few minutes ago, so there might not be much data generated.
Select Log Events. You might need to expand the Property panel on the right.
Select the InsightsMetrics row in the table.
The logs section of a Log Analytics workspace opens with a prepopulated query showing the data being collected.
Need help? See our troubleshooting guide or provide specific feedback by reporting an issue.