Enable Monitoring for the Server
Lab overview
vm-surfcity-01 is in production and Surf City IT has no visibility inside it. Azure gives you host-level metrics for free, but CPU, memory, and disk as Windows sees them need the Azure Monitor Agent, a data collection rule, and a Log Analytics workspace to land in. In this lab you create the log-surfcity workspace, enable log-based guest monitoring on the VM through the Configure monitor wizard, verify the agent extension and the data collection rule it created, read the resulting performance charts, and run two KQL queries in the workspace to see the collected data and the agent heartbeat for yourself.
Why you'd do this
There are two kinds of VM metrics in Azure and the difference is the point of this lab. Host metrics come from the hypervisor: CPU percentage, network bytes, disk operations. They cost nothing, need no agent, and are already on the VM's Monitor page when you open it. What they can't tell you is what Windows thinks is going on: available memory, logical disk free space, per-process pressure. For that you need a guest view, which means software inside the OS.
The current way to get it is the Azure Monitor Agent, steered by a data collection rule. The DCR is the interesting half: it declares which performance counters to sample, how often, and which workspace to send them to, and it's associated with the VM rather than baked into it, so one rule can drive a hundred servers. The wizard creates the rule for you with a generated name, msvmi-eastus2-vm-surfcity-01, and you'll go find it under Azure Monitor afterward to see the two halves: Resources (which VMs it applies to) and Data sources (performance counters → log-surfcity).
The Configure monitor page itself has changed recently, and the lab walks the current layout. It offers two experiences: OpenTelemetry metrics, a preview that wants a new Azure Monitor workspace, and Log-based metrics, the classic path into Log Analytics. You'll pick log-based so the story stays agent → DCR → workspace, the pattern AZ-104 expects. The one checkbox that matters most is Enable recommended alerts: it's on by default and would silently create an action group and a set of alert rules, so you'll turn it off, because building exactly that by hand is the next lab.
The last step is a short KQL query against InsightsMetrics and Heartbeat. Even five rows show you the shape of what the agent sends: a computer name, a namespace like Processor or LogicalDisk, a counter name, a value. One detail to notice on the Performance tab: the Logical Disk chart shows only C:, because the 32 GiB data disk from lab 3 is attached but was never initialized inside Windows, so it has no drive letter and no counters yet. Also allow five to ten minutes after enabling before guest data appears; an empty chart right after Enable is normal, not broken.
Lab details
- Log Analytics workspace:
log-surfcityinrg-surfcity-infra· Region: (US) East US 2 · Pricing tier Pay-as-you-go - Configure monitor: OpenTelemetry metrics unchecked · [Classic] Log-based metrics checked · workspace
log-surfcity· Enable recommended alerts unchecked - Data collection rule (created by the wizard):
msvmi-eastus2-vm-surfcity-01· Resources:vm-surfcity-01· Data source: Performance Counters →log-surfcity - VM extension: AzureMonitorWindowsAgent · Status Provisioning succeeded
- Queries:
InsightsMetrics | where Computer == "vm-surfcity-01" | take 5andHeartbeat | where Computer == "vm-surfcity-01" | take 5(Category: Azure Monitor Agent)
Learning objectives
- Create a Log Analytics workspace in an existing resource group.
- Distinguish host-level metrics from guest-level metrics on an Azure VM.
- Enable log-based guest monitoring on a VM and explain what the Azure Monitor Agent and a data collection rule each do.
- Verify a VM extension's provisioning state and inspect a data collection rule's resources and data sources.
- Read guest performance charts and recognize why an uninitialized data disk doesn't appear.
- Run a basic KQL query against InsightsMetrics and Heartbeat in Log Analytics.
Exam relevance
- AZ-104 — Microsoft Azure Administrator — monitor and maintain Azure resources: configure Azure Monitor Agent and data collection rules, Log Analytics workspaces, VM insights, basic KQL.
- AZ-900 — Microsoft Azure Fundamentals — Azure Monitor, Log Analytics, and the role of monitoring in operating cloud resources.
Where this lab fits in the project
Lab 7 gave Surf City Boats a second administrator; this lab gives the team eyes on the server they both manage. The log-surfcity workspace and the agent you enable here are the foundation for lab 9, where the CPU metric you can now see becomes an alert that emails Surf City IT when the server runs hot.
Everything lands in rg-surfcity-infra from lab 1, so the new workspace and data collection rule are covered by the Contributor assignment from lab 7, and by the lock and policy you'll apply in lab 12.
Step-by-step instructions
- Create the Log Analytics workspace:
- Confirm
vm-surfcity-01is running, then in the search box at the top of the portal, typeLog Analytics workspacesand select it under Services, then + Create. - Confirm the Surf City Boats subscription, select resource group
rg-surfcity-infra, name the workspacelog-surfcity, and confirm the region is (US) East US 2. - Select Review + Create, confirm Validation passed and the Pay-as-you-go pricing tier, then select Create.
- When deployment completes, select Go to resource and confirm the Overview shows resource group
rg-surfcity-infraand location East US 2.
- Confirm
- Open the VM's monitoring page:
- Search for
vm-surfcity-01and select it under Resources; in the left menu, under Monitoring, select Monitor. - Scroll down and review the host-level charts (CPU, network, disk) that are already populated with no agent installed; confirm the guest-level charts are empty.
- Scroll back up to the banner offering enhanced monitoring and select Configure.
- Search for
- Configure enhanced monitoring:
- On the Configure monitor page, review the Capabilities tab: OpenTelemetry proposes a new Azure Monitor workspace, and Enable recommended alerts is checked by default.
- Under Enable detailed metrics, uncheck OpenTelemetry metrics and check [Classic] Log-based metrics.
- Select Customize infrastructure monitoring, confirm the workspace is
log-surfcityand the DCR shows (New) msvmi-eastus2-vm-surfcity-01 (East US 2), then Save. - Under Additional Dashboarding, note Dashboards with Grafana shows At no additional cost (nothing to configure).
- Under Alerts, uncheck Enable recommended alerts.
- Select Review + enable, confirm the summary shows Log-based metrics sending to
log-surfcitywith a new data collection rule, select Enable, and wait for the notification that the agent extension deployed.
- Verify the agent and the data collection rule:
- In the VM's left menu, under Settings, select Extensions + applications and confirm AzureMonitorWindowsAgent shows Provisioning succeeded.
- Search for
Monitorand select it under Services; under Settings, select Data Collection Rules, open the Data collection rules tab, and selectmsvmi-eastus2-vm-surfcity-01. - Under Configuration, select Resources and confirm
vm-surfcity-01is associated. - Under Configuration, select Data sources and confirm the Performance Counters source sends to
log-surfcity.
- Examine the performance data:
- Return to
vm-surfcity-01→ Monitor; allow five to ten minutes after enabling for guest data to appear and refresh if the charts are still empty. - Confirm the Performance tab is selected.
- Review the Logical Disk Space Used % chart and confirm only the C: drive is listed — the lab 3 data disk was never initialized inside Windows, so it has no drive letter yet.
- Scroll down and review the remaining guest charts.
- Return to
- Query the collected data in the workspace:
- Search for
log-surfcityand select it under Resources; in the left menu, select Logs. - The page opens in Observability Agent mode — turn off the Agent toggle at the top right, then select Discard.
- In the Simple mode dropdown at the top right of the query pane, select KQL mode.
- Type
InsightsMetrics | where Computer == "vm-surfcity-01" | take 5and select Run; confirm five rows forvm-surfcity-01, each with a Namespace (Processor, Memory, or LogicalDisk) and a counter Name. - Double-click
InsightsMetricsin the query, typeHeartbeatin its place, select Run, and confirm the rows show Category Azure Monitor Agent.
- Search for
Launch the lab simulation — included with the labITpro All-Access Pass; no Azure subscription required.