Azure Monitor for Administrators: Metrics, Activity Log, Diagnostic Settings, Alerts and Action Groups
What Azure Monitor Gives You
| Data | What it is | Where |
|---|---|---|
| Metrics | Numbers over time (CPU %, requests). Near real time, kept 93 days | Metrics store |
| Logs | Records and events you query | Log Analytics workspace |
| Activity log | Who did what to which resource (control plane), kept 90 days | Subscription level |
| Resource logs | Detailed logs of a service. Off until you create diagnostic settings | Workspace, storage, Event Hubs |
Metrics
bash
az monitor metrics list --resource $(az vm show -g rg-vm -n web01 --query id -o tsv) --metric "Percentage CPU" --interval PT5M --aggregation Average -o table
- In the portal use Metrics to chart, split by dimension and pin to a dashboard
- Platform metrics are collected automatically. Guest OS metrics (memory, disk) need the Azure Monitor Agent
Activity Log
- Shows create, update, delete and role changes with caller, time and status
- Use it to answer 'who deleted this VM?'
- Export it to a Log Analytics workspace to keep longer
bash
az monitor activity-log list --resource-group rg-vm --offset 1d --query "[?operationName.value=='Microsoft.Compute/virtualMachines/delete'].{who:caller, time:eventTimestamp}" -o table
Diagnostic Settings
bash
az monitor diagnostic-settings create --name to-law --resource $(az keyvault show -n kv-demo-482 --query id -o tsv) \
--workspace $(az monitor log-analytics workspace show -g rg-ops -n law-ops --query id -o tsv) \
--logs '[{"category":"AuditEvent","enabled":true}]' --metrics '[{"category":"AllMetrics","enabled":true}]'
- Destinations: Log Analytics, Storage account (cheap archive), Event Hubs (stream to other tools)
Alerts
| Alert type | Use |
|---|---|
| Metric | CPU over 80%, queue length high |
| Log search | KQL query result count |
| Activity log | A resource was deleted |
| Service Health | Azure incidents and planned maintenance affecting you |
| Alert part | Meaning |
|---|---|
| Scope | What to watch |
| Condition | Signal, operator, threshold, evaluation frequency and window |
| Severity | 0 Critical to 4 Verbose |
| Action group | Who or what to notify or run |
bash
az monitor action-group create -g rg-ops -n ag-ops --short-name ops --action email admin admin@contoso.com
az monitor metrics alert create -g rg-ops -n vm-high-cpu --scopes $(az vm show -g rg-vm -n web01 --query id -o tsv) \
--condition "avg Percentage CPU > 80" --window-size 5m --evaluation-frequency 1m --severity 2 --action ag-ops
- Action groups can send email, SMS, push and voice, call a webhook or run a Function, Logic App or Automation runbook
- Alert processing rules suppress alerts during maintenance or add action groups to many alerts
- Alerts have states: New, Acknowledged, Closed
- Avoid alert noise: alert on symptoms and tune thresholds
Practice
- Create a CPU alert on a VM with an email action group
- Find who deleted a resource in the Activity log
- Send Key Vault logs to a Log Analytics workspace
- Create a Service Health alert for your region
Conclusion
Azure Monitor collects metrics, the Activity log and resource logs (after diagnostic settings). Create alerts with action groups, use processing rules to cut noise and keep logs where you can query them.
Quick Summary: data types; metrics; Activity log; diagnostics; alerts.

