AzureAZ-104

Azure Monitor and Diagnostics Explained for AZ-104

You deploy a VM, a database, and a web app. Within minutes, questions arise: is the VM CPU within normal range? Did that deployment increase error rates? Who changed the firewall rule at 2am? Azure Monitor is where those answers come from. It is the unified observability platform that collects metrics and logs from virtually every Azure resource, lets you query them, visualize them, and react to them with alerts. Log Analytics provides the query engine, Application Insights covers the application layer, and diagnostic settings wire resources into the collection pipeline. The AZ-104 exam tests how to configure monitoring, write basic queries, and set up alerts that actually catch problems.

7 min
3 sections · 8 exam key points

Azure Monitor: metrics, logs, and diagnostic settings

Azure Monitor collects two types of data. Metrics are numeric time-series values that resources emit at regular intervals: VM CPU percentage, storage account transaction count, App Service response time. Metrics are stored for up to 93 days and are available near-real-time. Logs are structured records of events: a VM emitting its Windows event log, an NSG emitting flow log records, or your application emitting custom trace messages. Logs are stored in Log Analytics workspaces and retained based on the workspace retention policy.

Diagnostic settings control which metrics and logs a resource sends to which destination. By default, most Azure resources do not automatically send logs anywhere: you must configure diagnostic settings on each resource to route data to a Log Analytics workspace, a storage account, an Event Hub, or a combination. Platform metrics are automatically collected for most services without diagnostic settings, but resource logs require explicit configuration. Missing diagnostic settings is the most common reason monitoring data is unavailable during an incident.

Log Analytics workspaces are the destination for log data and the query engine for analysis. Data from multiple resources and subscriptions can flow into a single workspace, enabling cross-resource queries. Queries use Kusto Query Language (KQL), a readable syntax designed for log analytics. A basic KQL query filters by resource type, time range, and a keyword; more complex queries aggregate, join, and project to answer specific questions about application behavior.

Alerts, Application Insights, and Azure Monitor integration

Azure Monitor alerts trigger when a metric or log query result crosses a threshold or matches a condition. Metric alerts are evaluated continuously and fire as soon as the condition is met, typically within a minute. Log search alerts run a KQL query on a schedule and trigger when the result count or value exceeds a threshold. When an alert fires, it triggers an action group: a named set of actions including email notifications, SMS, voice calls, webhook calls, Azure Functions invocations, or ITSM integrations.

Application Insights is the application performance monitoring (APM) layer of Azure Monitor. It instruments your application code to collect traces, exceptions, dependency calls, and custom events. In the Azure portal, Application Insights provides live metrics, failure analysis, request rate and response time trending, and end-to-end distributed tracing across multiple services. For web applications, Application Insights is the difference between knowing your application is slow and knowing exactly which database call is making it slow.

Azure Monitor Workbooks combine metrics, logs, and static text into interactive reports. They are useful for operational dashboards, weekly reliability reviews, and capacity planning documents. Azure Monitor for VMs provides pre-built dashboards for VM performance and dependencies. Activity Log captures all control-plane operations in Azure (who created, modified, or deleted resources) and integrates with alerts so you can detect unauthorized changes.

How to choose the correct answer

Metrics: numeric, near-real-time, 93-day retention, no diagnostic settings needed for platform metrics.

Logs: structured events, Log Analytics workspace, KQL queries, configurable retention.

Diagnostic settings: required to route resource logs and metrics to Log Analytics, Storage, or Event Hub.

Metric alert: fires on numeric threshold breach, fast response (within minutes).

Log search alert: KQL query runs on schedule, fires on result condition. Useful for pattern-based detection.

Action group: defines what happens when an alert fires (email, SMS, webhook, function, ITSM).

Application Insights: application-level APM, traces, exceptions, dependencies, distributed tracing.

Activity Log: control-plane audit trail (who did what to which Azure resource). 90-day default retention.

Key exam facts — AZ-104

  • Azure Monitor metrics: auto-collected, 93-day retention, near-real-time, numeric time-series.
  • Resource logs: require diagnostic settings to collect. Not sent anywhere by default.
  • Log Analytics: stores log data, KQL query engine, cross-resource and cross-subscription queries.
  • Metric alerts: evaluate continuously, trigger fast on threshold. Log alerts: query-based, scheduled.
  • Action groups: reusable sets of notification and automation actions triggered by alerts.
  • Application Insights: SDK-based or auto-instrumentation, live metrics, distributed tracing, availability tests.
  • Activity Log: 90-day default retention, tracks resource management operations, exportable to Log Analytics.
  • Diagnostic settings: per-resource configuration routing logs/metrics to workspace, storage, or event hub.

Common exam traps

Azure Monitor automatically collects all logs from Azure resources without any configuration.

Platform metrics are collected automatically for most Azure services. Resource logs (diagnostic logs) require explicit diagnostic settings on each resource to specify what data to collect and where to send it. Many organizations discover during an incident that no log data is available because diagnostic settings were never configured.

Log Analytics and Application Insights are separate products that do not integrate.

Application Insights is built on top of Log Analytics. Application Insights data is stored in a Log Analytics workspace and can be queried using KQL alongside other Azure resource logs. A workspace-based Application Insights resource (the current recommended mode) allows correlation of application traces with infrastructure logs in the same query environment.

Metric alerts and log search alerts are interchangeable for detecting problems.

Metric alerts evaluate a numeric threshold continuously and fire within minutes of a breach, making them ideal for real-time performance alerts like CPU spikes. Log search alerts run a KQL query on a schedule (every 5 minutes at minimum) and are better for pattern detection, error counting, or conditions that require correlating multiple log entries. Each has scenarios where it is the better tool.

Practice this topic

Test yourself on Azure Monitor

JT Exams routes you to questions in your exact weak areas — automatically, after every session.

No credit card · Cancel anytime

Related certification topics