Monitor & maintain Azure resources
This topic covers Azure Monitor, Log Analytics, alerts, Network Watcher and backup/recovery basics for AZ-104.
Azure Monitor building blocks
- Azure Monitor collects two core data types: metrics (numerical, time-series, lightweight) and logs (structured records queried with Kusto Query Language, KQL).
- Metrics are stored for 93 days by default in the platform metrics database.
- Logs are sent to a Log Analytics workspace; default retention is 30 days (interactive retention configurable 30-730 days on the workspace).
- Diagnostic settings route resource logs and metrics to a Log Analytics workspace, Storage account, or Event Hub - a resource is not monitored in depth until a diagnostic setting is created.
Activity Log vs resource logs
- The Activity Log records subscription-level control-plane events (who did what, when) and is retained 90 days automatically, with no configuration needed.
- Resource logs (data-plane operations, e.g. inside a VM or storage account) require an explicit diagnostic setting and are NOT enabled by default.
- A common exam trap: assuming resource logs exist automatically like the Activity Log - they don't.
Alerts
- Alert rules have three parts: signal (metric, log, activity log), condition/threshold, and action group.
- Action groups define the response: email, SMS, push, voice, webhook, Azure Function, Logic App, or runbook.
- Metric alerts can use static or dynamic thresholds; dynamic thresholds learn normal patterns using machine learning.
- Log alerts run a scheduled KQL query at a set frequency and fire when results meet the condition.
VM insights and diagnostics
- Azure Monitor Agent (AMA) is the current unified agent, replacing the legacy Log Analytics agent (MMA/OMS), which retired 31 August 2024.
- VM insights uses AMA plus data collection rules (DCRs) to gather performance counters and map dependencies.
- Boot diagnostics captures console output and screenshots to troubleshoot VM startup issues - stored in a storage account.
Network Watcher
- Network Watcher provides diagnostic tools: IP flow verify, Next hop, Connection troubleshoot, and Packet capture.
- NSG flow logs (version 2 preferred) record allowed/denied traffic through a network security group and can feed Traffic Analytics for visualisation.
Backup and recovery basics
- Azure Backup uses a Recovery Services vault; default backup policy for VMs is once daily, with instant restore points kept for 1-7 days.
- Soft delete keeps deleted backup data recoverable for 14 days by default, protecting against accidental or malicious deletion.
- Azure Site Recovery (ASR) handles disaster recovery/replication and is a separate service from Azure Backup, though both use a Recovery Services vault.
Common mistakes
- Forgetting resource logs need a diagnostic setting configured explicitly.
- Confusing metric alerts (fast, near real-time) with log alerts (slower, query-based, minimum 5 minute frequency).
- Assuming the legacy Log Analytics agent still works - it's retired; use AMA.
How long does Azure Monitor keep platform metrics by default?
93 days.
tap to reveal
What is the default retention period for a Log Analytics workspace?
30 days (configurable from 30 to 730 days).
tap to reveal
How long is the Activity Log retained, and does it need configuring?
90 days, retained automatically with no setup required.
tap to reveal
Do resource logs get collected automatically like the Activity Log?
No - they require an explicit diagnostic setting sending logs to a workspace, storage account, or event hub.
tap to reveal
What agent replaced the legacy Log Analytics (MMA) agent, and when did the old one retire?
Azure Monitor Agent (AMA); the legacy agent retired 31 August 2024.
tap to reveal
What is the minimum run frequency for a log alert rule?
5 minutes.
tap to reveal
What do dynamic thresholds use to set alert conditions?
Machine learning that adapts to the resource's normal metric pattern over time.
tap to reveal
What are the four main Network Watcher diagnostic tools?
IP flow verify, Next hop, Connection troubleshoot, and Packet capture.
tap to reveal
What does an action group define in an Azure Monitor alert?
The response actions - email, SMS, push, voice, webhook, Azure Function, Logic App, or Automation runbook.
tap to reveal
What is the default soft-delete retention for Azure Backup data in a Recovery Services vault?
14 days.
tap to reveal
What is the default Azure VM backup frequency and instant restore point retention?
Once daily backup, with instant restore points kept for 1-7 days.
tap to reveal
What service handles disaster recovery/replication separately from Azure Backup, though sharing a vault type?
Azure Site Recovery (ASR), using a Recovery Services vault.
tap to reveal
What query language is used to analyse logs in a Log Analytics workspace?
Kusto Query Language (KQL).
tap to reveal
What does NSG flow logging (v2) feed into for visualisation?
Traffic Analytics.
tap to reveal
What captures console output and screenshots to troubleshoot a VM that fails to start?
Boot diagnostics, stored in a storage account.
tap to reveal