Use it to see why an Azure resource or VM misbehaves, who changed it, and to alert on conditions before users notice.
Azure Monitor and Log Analytics
Azure Monitor collects metrics, logs and traces from Azure resources, VMs, containers and applications. Platform metrics and the Activity log are collected automatically; resource logs need a diagnostic setting; guest OS data needs the Azure Monitor Agent with a data collection rule. Logs land in a Log Analytics workspace and are queried with KQL.
1. Is the data collected at all (diagnostic setting, agent + DCR)?
2. Which workspace and which table?
3. Is the time range and scope right?
4. Does the alert rule evaluate the data you think it does, and does its action group reach anyone?
resource/VM → collection (platform metrics, diagnostic setting, AMA + DCR) → destination (workspace, storage, event hub) → query (KQL / metrics explorer) → alert rule → action group → people/automation
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
az monitor diagnostic-settings list --resource "$RES" \Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Read-only Verification Verify boundary
RES=$(az vm show -g rg-app -n vm-app01 --query id -o tsv)
# Is anything collected for this resource, and where to?
az monitor diagnostic-settings list --resource "$RES" \
--query "[].{name:name, workspace:workspaceId, logs:logs[].categoryGroup}"
# Platform metric values (last hour, 5-minute grain)
az monitor metrics list --resource "$RES" --metric "Percentage CPU" \
--interval PT5M --offset 1h --output table
# Data collection rules associated with a VM (AMA)
az monitor data-collection rule association list --resource "$RES" --output table
# Alert rules in a resource group and whether they are enabled
az monitor metrics alert list -g rg-app --query "[].{name:name, enabled:enabled, severity:severity}" -o table
az monitor scheduled-query list -g rg-app --query "[].{name:name, enabled:enabled}" -o table
// Which machines still send a heartbeat, and when did each last report?
Heartbeat
| summarize LastSeen = max(TimeGenerated) by Computer, OSType
| order by LastSeen asc
Step 2 Common mistakes Narrow the fault
- Assuming resource logs exist because metrics do — they need a diagnostic setting.
- Sending each resource to its own workspace, which makes cross-resource queries and access control harder.
- Collecting
allLogseverywhere without looking at ingestion cost. - Alert rules without a tested action group, or one shared email address nobody reads.
- Querying from a resource scope and concluding that other resources have no data.
Step 3 Troubleshooting Narrow the fault
Query returns nothing. Check in order: time range, query scope (resource vs workspace), the table name (resource-specific vs AzureDiagnostics mode), whether a diagnostic setting exists, and ingestion delay — new settings can take up to about 90 minutes.
VM data missing. Is the Azure Monitor Agent extension provisioned? Is a DCR associated? Can the VM reach the Azure Monitor endpoints (proxy, firewall, private link scope)? Check Heartbeat first.
Alert did not fire. Look at the alert rule's history: did the condition evaluate true? If it fired, check the action group: is the email/SMS/webhook configured and not rate-limited? Test the action group from the portal.
Costs grow unexpectedly. Find the tables with the most ingestion (Usage | summarize sum(Quantity) by DataType) and reduce collection at the source (DCR filters, fewer diagnostic categories).
No diagnostic setting, no resource logs. Metrics ≠ logs: metrics are numeric time series kept automatically for a limited time; logs are records you choose to collect and pay for. Query scope decides what you see: workspace scope shows all its data, resource scope only that resource's.
az monitor diagnostic-settings list --resource <id>— is anything collected, and where to?az monitor metrics list --resource <id> --metric <name>— platform metric values.- KQL
Heartbeat | summarize max(TimeGenerated) by Computer— which agents still report. az monitor activity-log list— control-plane changes.
ReferenceWhat it is2 sections · depth on demand
Direct Answer
Azure Monitor is Azure's built-in monitoring service. Three kinds of data matter day to day:
- Platform metrics — numeric time series (CPU %, requests, latency) that every resource emits automatically.
- Activity log — the subscription's control-plane log: who created, changed or deleted what. Also automatic.
- Resource logs — detailed per-resource logs (firewall decisions, Key Vault access, App Service HTTP logs). Not collected until you create a diagnostic setting.
Logs are stored in a Log Analytics workspace and queried with KQL. Inside VMs, the Azure Monitor Agent collects event logs, syslog and performance counters as defined by data collection rules. Alert rules watch metrics or log queries and call action groups (email, SMS, webhook, Logic App, runbook).
Scope and canonical references
This Topic covers Azure's monitoring service. Neighbouring Topics:
- Monitoring concepts that are not Azure-specific belong to the Observability Domain.
- Control-plane change history for a whole subscription is introduced in Cloud Fundamentals.
- Network diagnostics with Network Watcher are in Azure Networking.
- Container insights for AKS clusters: Azure Kubernetes Service (AKS).
ReferenceImportant terms & boundaries1 section · depth on demand
In depth
Where data comes from
| Data | Collected by default? | How to get it into a workspace |
|---|---|---|
| Platform metrics | Yes (kept for a limited period in the metrics store) | Diagnostic setting, if you also want them as logs |
| Activity log | Yes | Diagnostic setting on the subscription |
| Resource logs | No | Diagnostic setting per resource |
| Guest OS logs and counters | No | Azure Monitor Agent + data collection rule (DCR) |
| Application traces | No | Application Insights / OpenTelemetry |
Diagnostic settings send a resource's logs and metrics to up to one destination of each type: a Log Analytics workspace, a storage account (cheap retention), an Event Hub (stream to a SIEM) or a partner solution. A resource can have up to five settings; the destination must exist first and, for storage and Event Hubs, be in the same region. Category groups make this simple: allLogs collects everything, audit only audit-type logs. Data normally starts to flow within about 90 minutes of creating the setting.
Log Analytics workspaces hold tables such as AzureActivity, AzureDiagnostics (or resource-specific tables like AZFWNetworkRule), Heartbeat, Perf, Event and Syslog. Opening Logs from the workspace queries all of it; opening Logs from a single resource limits the query to that resource's data.
Azure Monitor Agent (AMA) runs inside Windows and Linux VMs (and Arc-enabled servers). What it collects and where it sends it is defined in data collection rules associated with the machine. A VM with the agent but no DCR association collects nothing useful.
Alerts: metric alerts evaluate a metric against a static or dynamic threshold; log search alerts run a KQL query on a schedule; activity log alerts fire on control-plane events or service health. Every alert rule points at one or more action groups.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Deep reference
Healthy vs suspicious evidence
Output interpretation
Diagnostic settings list: an empty list [] means the resource sends no resource logs anywhere — the most common reason a query returns nothing. A workspaceId that points at a different subscription or a test workspace explains "the logs are somewhere else".
az monitor metrics list: each row is a time bucket with an aggregation (Average, Maximum…). Empty values for recent buckets usually mean the resource was stopped or the metric is not emitted for that SKU, not that it is zero.
Heartbeat query: a machine whose LastSeen is older than a few minutes has stopped reporting — the agent is stopped, the VM is off, the DCR association was removed, or outbound access to the monitoring endpoints is blocked. A machine missing from the result never reported to this workspace.
DCR associations: no rows means the agent has no instructions; a VM can have the extension installed and still collect nothing.
Design & tradeoffs
Design decisions
Workspace layout. One central workspace per environment (or per region where data residency demands it) keeps queries and access simple; separate workspaces are justified by data sovereignty, billing separation or very different retention needs.
Retention and cost. Keep interactive retention short for high-volume tables and archive or export the rest to storage; collect only the diagnostic categories you actually query.
Enforce collection with policy. Azure Policy can deploy diagnostic settings and DCR associations automatically, so new resources are not silently unmonitored.
Alert design. Alert on symptoms users feel (availability, latency, errors) and on capacity that needs action, route by severity to different action groups, and review alerts that fire without anyone acting on them.