RousselTMLEARNING

Cloud computing

Observability on Azure: Azure Monitor, Log Analytics, Application Insights, managed Prometheus and Grafana

A complete overview of observability on Azure: Azure Monitor (metrics, logs and Log Analytics, KQL), Application Insights, Azure Monitor Agent and data collection rules, managed Prometheus and Grafana, Container Insights, alerts and action groups, OpenTelemetry compatibility, supported pillars and external integrations.

1. Overview #

Azure Monitor and its data stores.

A single platform: Azure Monitor #

On Azure, all observability goes through Azure Monitor. It relies on two main stores: Azure Monitor Metrics (lightweight time series, kept 93 days) and Azure Monitor logs stored in Log Analytics workspaces and queried with KQL (Kusto Query Language). Application Insights provides APM and stores its data (requests, dependencies, traces, exceptions) in Log Analytics. For Kubernetes and Prometheus metrics, Azure offers Azure Monitor managed service for Prometheus and Azure Managed Grafana.

Azure Monitor architecture
On the left the data producers, in the center the internal Azure Monitor components, on the right the external tools. The components outlined in orange (Managed Grafana, query APIs, action groups, Event Hubs) are the only openings to the outside.

Supported pillars #

PillarAzure componentExplorationOpenTelemetry
MetricsAzure Monitor Metrics, Managed PrometheusMetrics Explorer, PromQL✅ Yes
LogsLog Analytics (tables, Analytics, Basic, Auxiliary plans)KQL, Logs, Workbooks✅ Yes
TracesApplication Insights (AppRequests, AppDependencies tables)Transaction search, application map✅ Yes (Azure Monitor OpenTelemetry distro)
ProfilesApplication Insights Profiler (.NET, Java)Per-request profiling traces🟡 Partial (Azure-specific Profiler)
RUM and syntheticApplication Insights (browser SDK), standard availability testsUser experience, web tests🟡 Partial
Events and auditActivity log, Change AnalysisKQL, Azure Resource Graph❌ No
Good to know: The Application Insights Snapshot Debugger captures variable state at the moment of an exception in production (.NET): a useful complement to profiles.

2. The components in detail #

Role of each Azure Monitor building block.

Platform metrics and diagnostic settings #

Every Azure resource publishes its platform metrics for free. Resource logs (application gateway requests, database audit logs, etc.) are only collected if you create a diagnostic setting that sends them to Log Analytics, a storage account, Event Hubs or a partner solution. The activity log records management operations (creation, deletion, configuration changes).

az monitor diagnostic-settings create --name vers-law \
  --resource /subscriptions/<abonnement>/resourceGroups/rg-prod/providers/Microsoft.Web/sites/api-boutique \
  --workspace /subscriptions/<abonnement>/resourceGroups/rg-obs/providers/Microsoft.OperationalInsights/workspaces/law-prod \
  --logs '[{"category":"AppServiceHTTPLogs","enabled":true}]' --metrics '[{"category":"AllMetrics","enabled":true}]'

Log Analytics and KQL #

A Log Analytics workspace contains tables (Syslog, Perf, ContainerLogV2, AppRequests…). Each table can use the Analytics plan (full queries, alerts), Basic or Auxiliary (cheaper, limited queries) depending on usage. Interactive retention and long-term archiving are set per table.

AppRequests
| where TimeGenerated > ago(1h)
| summarize requetes = count(), erreurs = countif(Success == false),
            p95 = percentile(DurationMs, 95) by bin(TimeGenerated, 5m), Name
| order by TimeGenerated desc

Azure Monitor Agent and data collection rules (DCR) #

The Azure Monitor Agent (AMA) replaces the legacy Log Analytics agents (MMA/OMS). It collects system logs, performance counters and text files on Windows and Linux VMs, including outside Azure through Azure Arc. What it collects and where it sends it is described in data collection rules (DCR), which can also filter and transform data in KQL before ingestion to reduce costs.

Application Insights #

Application Insights is the APM building block: incoming requests, outgoing dependencies, exceptions, traces, application map, failure and performance analysis, end-to-end transaction search, live metrics, availability tests and user experience (JavaScript SDK). An Application Insights resource is attached to a Log Analytics workspace.

Kubernetes: Container Insights, managed Prometheus and Grafana #

On AKS, Container Insights collects container logs and inventory, while Managed Prometheus collects metrics (default targets, ServiceMonitor and PodMonitor) into an Azure Monitor workspace. Azure Managed Grafana connects to it with ready-to-use dashboards.

az aks update --resource-group rg-prod --name aks-prod \
  --enable-azure-monitor-metrics \
  --azure-monitor-workspace-resource-id <id-espace-azure-monitor> \
  --grafana-resource-id <id-grafana-manage>

Alerts, action groups and workbooks #

TypeUse
Metric alertsStatic or dynamic thresholds on metrics, evaluated every minute
Log search alertsScheduled KQL query; ideal for complex conditions
Prometheus alertsPromQL rule groups on the Azure Monitor workspace
Activity log and Service Health alertsManagement operations and Azure platform incidents
Action groupsNotifications (email, SMS, app) and actions (webhook, Logic Apps, Functions, ITSM)
WorkbooksInteractive reports combining metrics, KQL and parameters

3. Detailed sheet for each component #

Role, content, data types, retention and internal and external interactions of each building block in the diagram.

Summary view #

The following table summarizes each component of the architecture diagram; the sheets that follow detail them one by one.

ComponentZoneSignalsCan be opened to the outside
Diagnostic settingsCollectionResource logs, metrics🔒 No (internal)
AMA + DCR rulesCollectionLogs, counters, metrics🔒 No (internal)
Azure Monitor MetricsStorageMetrics🟡 Indirectly
Managed PrometheusStoragePrometheus metrics🟡 Indirectly
Log AnalyticsStorageLogs, traces, events🟡 Indirectly
Application InsightsAPMTraces, requests, exceptions, profiles🟡 Indirectly
Managed GrafanaOutputVisualization🟠 Yes
Query APIsOutputAll🟠 Yes
Alerts and action groupsOutputEvents🟠 Yes
Event HubsOutputStreamed logs and metrics🟠 Yes
Indicative values: Retention periods, limits and pricing models change regularly: check them in the official documentation before sizing an architecture.

Diagnostic settings #

The mechanism that enables collection of an Azure service's resource logs and chooses their destination.

CharacteristicDetail
RoleRoute resource logs, platform metrics and the activity log to one or more destinations.
ContentUp to 5 settings per resource; choice of log categories (or allLogs, audit groups) and metrics (AllMetrics).
Data typeResource logs (requests, audits, errors), platform metrics, subscription activity log.
Storage and retentionNone: routing only.
Inputs (internal components)Azure resources (App Service, Key Vault, SQL, Application Gateway…).
Outputs (internal components)Log Analytics, storage account, Event Hubs, partner solutions.
External interactionsThrough Event Hubs or native ISV services (Datadog, Elastic, Dynatrace, New Relic).
Can be opened to the outside🔒 No (internal): it feeds components that can be opened but exposes nothing itself.
Security and accessMonitoring Contributor role; deployment at scale with Azure Policy (DeployIfNotExists).
CostFree; you pay for ingestion at the destination.

Azure Monitor Agent (AMA) and data collection rules (DCR) #

Azure Monitor's single collection agent, driven by data collection rules.

CharacteristicDetail
RoleCollect logs and counters from virtual machines and servers, filter and transform before ingestion.
ContentDCR rules: sources (performance counters, Syslog, Windows events, text and JSON files, IIS), destinations, KQL transformations; DCE endpoints; logs ingestion API for applications.
Data typeSystem and application logs, performance counters, guest metrics; Prometheus metrics on AKS (ama-metrics add-on).
Storage and retentionNone: local buffer.
Inputs (internal components)Azure VMs, scale sets, on-premises or other cloud servers through Azure Arc, AKS clusters.
Outputs (internal components)Log Analytics, Azure Monitor Metrics, Managed Prometheus (Azure Monitor workspace).
External interactionsNone directly: go through Event Hubs or the APIs.
Can be opened to the outside🔒 No (internal)
Security and accessMachine managed identity; DCR associations through Azure Policy.
CostFree; ingestion billed at the destination (reduced by transformations).

Azure Monitor Metrics #

Azure Monitor's lightweight and fast metrics store.

CharacteristicDetail
RoleStore numeric metrics for all resources and feed alerts, autoscaling and dashboards.
ContentPlatform metrics (automatic), guest and custom metrics; dimensions; Metrics Explorer.
Data typeTime series, one-minute granularity.
Storage and retentionKept 93 days.
Inputs (internal components)Azure resources (automatic), AMA, Application Insights (custom metrics).
Outputs (internal components)Metric alerts, autoscaling, Managed Grafana, diagnostic settings (export to Log Analytics, storage, Event Hubs).
External interactionsRead by Grafana, Datadog, Dynatrace through the Metrics REST API.
Can be opened to the outside🟡 Indirectly: through the REST API and diagnostic settings export.
Security and accessAzure RBAC (Monitoring Reader); managed identities for tools.
CostPlatform metrics free; custom metrics and API calls billed.

Azure Monitor managed service for Prometheus #

Azure's managed Prometheus service, backed by an Azure Monitor workspace.

CharacteristicDetail
RoleStore and query Prometheus metrics in PromQL, especially those of AKS and Azure Arc-enabled Kubernetes.
ContentAzure Monitor workspace, Prometheus rule groups (recording and alerting), PromQL query endpoint.
Data typePrometheus time series.
Storage and retentionKept 18 months.
Inputs (internal components)AKS ama-metrics add-on (default targets, ServiceMonitor, PodMonitor), remote write from Prometheus or a collector.
Outputs (internal components)Managed Grafana, Prometheus alerts to action groups.
External interactionsAny PromQL-compatible tool (self-hosted Grafana, KEDA) through the query endpoint.
Can be opened to the outside🟡 Indirectly: through its PromQL API.
Security and accessEntra ID (managed identity or service principal) with the Monitoring Data Reader role.
CostSamples ingested and queried.

Log Analytics #

The heart of Azure Monitor logs: a workspace containing tables queried in KQL.

CharacteristicDetail
RoleStore and analyze logs, traces, events and security data; serve as the foundation of Application Insights and Microsoft Sentinel.
ContentTables (Syslog, Perf, Event, ContainerLogV2, AzureDiagnostics, Application Insights App* tables, custom tables), KQL queries, workbooks, functions.
Data typeColumn-structured records (logs, traces, guest metrics, events).
Storage and retentionInteractive retention of 30 days by default (up to 2 years) and total retention up to 12 years; Analytics, Basic and Auxiliary table plans.
Inputs (internal components)Diagnostic settings, AMA and DCR, Application Insights, logs ingestion API.
Outputs (internal components)Log search alerts, workbooks, Managed Grafana, data export rules.
External interactionsExport rules to Event Hubs or storage; queries through the Log Analytics API from Grafana or a SIEM.
Can be opened to the outside🟡 Indirectly: through the query API and export rules.
Security and accessRBAC at workspace, table or resource level (resource context); private links.
CostIngestion per GB depending on the table plan, retention beyond the included period, queries on Basic and Auxiliary plans.

Application Insights #

Azure Monitor's APM building block.

CharacteristicDetail
RoleTrack application performance and reliability: requests, dependencies, exceptions, availability, user experience.
ContentApplication map, transaction search, failure and performance analysis, live metrics, availability tests, Profiler, Snapshot Debugger.
Data typeRequests, dependencies, exceptions, traces, page views, custom metrics, availability results.
Storage and retentionIn the associated Log Analytics workspace (AppRequests, AppDependencies, AppExceptions… tables), according to its retention.
Inputs (internal components)Azure Monitor OpenTelemetry distro, Java agent, JavaScript SDK, App Service auto-instrumentation.
Outputs (internal components)Log Analytics, Azure Monitor Metrics (standard metrics), alerts.
External interactionsOpenTelemetry data can be duplicated to a third-party APM by the collector.
Can be opened to the outside🟡 Indirectly: through the Log Analytics API.
Security and accessConnection string; Entra ID authentication of ingestion available; RBAC.
CostSame as Log Analytics (ingestion); sampling reduces volume.

Azure Managed Grafana #

A Grafana instance managed by Microsoft, integrated with Entra ID.

CharacteristicDetail
RoleVisualize metrics, logs and traces from several sources in shared dashboards.
ContentReady-to-use dashboards for Azure and AKS, Azure Monitor, Prometheus, Azure Data Explorer data sources and plugins.
Data typeStores no telemetry.
Storage and retentionDashboards and configuration.
Inputs (internal components)Azure Monitor Metrics, Managed Prometheus, Log Analytics, Application Insights.
Outputs (internal components)Grafana alerts and notifications.
External interactionsCan query sources outside Azure (Prometheus, Loki, Datadog) through plugins.
Can be opened to the outside🟠 Yes: web interface and Grafana API, with public access or a private endpoint.
Security and accessEntra ID, Grafana Admin, Editor, Viewer roles; managed identity to read data.
CostPer instance and per active user (Standard tier).

Query APIs (Azure Monitor, Log Analytics, Prometheus) #

The endpoints that expose Azure Monitor data for reading.

CharacteristicDetail
RoleLet tools, scripts and dashboards query metrics and logs.
ContentAzure Monitor Metrics REST API, Log Analytics query API (KQL), Azure Monitor workspace Prometheus HTTP API, Azure Resource Graph; Azure Monitor Query libraries.
Data typeJSON responses.
Inputs (internal components)Azure Monitor Metrics, Log Analytics, Managed Prometheus.
Outputs (internal components)Managed Grafana and any authorized client.
External interactionsSelf-hosted or Cloud Grafana, SIEM, third-party observability tools, scripts.
Can be opened to the outside🟠 Yes: public or private endpoints (Azure Monitor Private Link Scope).
Security and accessEntra ID token (service principal or managed identity); read RBAC.
CostFree for most queries; billed on Basic and Auxiliary tables.

Alerts and action groups #

Azure Monitor's alerting engine and its notification and action channels.

CharacteristicDetail
RoleDetect conditions in the data and notify or act automatically.
ContentMetric alerts (static or dynamic thresholds), log search alerts (KQL), Prometheus, activity log and Service Health alerts; alert processing rules; common alert schema.
Data typeAlert instances (fired, resolved) in the common JSON schema.
Inputs (internal components)Azure Monitor Metrics, Log Analytics, Managed Prometheus, activity log.
Outputs (internal components)Action groups: Automation runbooks, Logic Apps, Azure Functions.
External interactionsEmail, SMS, voice and mobile notifications, webhooks, ITSM connectors (ServiceNow), PagerDuty, Teams.
Can be opened to the outside🟠 Yes: outgoing webhooks and notifications.
Security and accessMonitoring Contributor role; secure webhooks (Entra ID authentication available).
CostPer alert rule and per notification (SMS, calls).

Azure Event Hubs #

Azure's streaming platform, used as a telemetry export gateway.

CharacteristicDetail
RoleContinuously receive logs and metrics from Azure Monitor and make them available to external consumers.
ContentNamespace, event hubs, partitions, consumer groups; AMQP protocol and Apache Kafka compatibility.
Data typeJSON events (diagnostic settings records, Log Analytics exports).
Storage and retentionRetention of 1 to 7 days (Standard), up to 90 days (Premium, Dedicated); optional capture to storage.
Inputs (internal components)Diagnostic settings, Log Analytics export rules, activity log.
Outputs (internal components)Azure Functions, Stream Analytics, storage (Capture).
External interactionsSplunk (add-on), Elastic Agent and Logstash, Datadog (forwarder function), Sumo Logic, IBM QRadar, Kafka consumers.
Can be opened to the outside🟠 Yes: it is the main continuous export channel to the outside.
Security and accessShared access signatures (SAS) or Entra ID; private endpoints and firewall rules.
CostThroughput or processing units and event volume.

4. OpenTelemetry compatibility #

Azure Monitor OpenTelemetry distro and collector.

Instrumenting with the Azure Monitor OpenTelemetry distro #

Microsoft now recommends OpenTelemetry for Application Insights: the Azure Monitor OpenTelemetry distro (.NET, Java, Node.js, Python) bundles the SDK, automatic instrumentation of common libraries and the Azure Monitor exporter. OpenTelemetry traces, metrics and logs become requests, dependencies, traces and custom metrics in Application Insights.

pip install azure-monitor-opentelemetry

# app.py
from azure.monitor.opentelemetry import configure_azure_monitor
configure_azure_monitor()   # lit APPLICATIONINSIGHTS_CONNECTION_STRING

With an OpenTelemetry Collector, the azuremonitor exporter from the contrib distribution sends traces, metrics and logs to Application Insights; metrics can also go by remote write to Managed Prometheus. Azure Monitor also offers native OTLP ingestion, currently rolling out: check its availability in your region before relying on it.

Good to know: For Java, the Application Insights 3.x agent is itself built on OpenTelemetry: it instruments without code changes and accepts the OpenTelemetry APIs for custom telemetry.

5. Interconnections with external products #

Exporting and integrating.

Sending Azure data elsewhere #

MechanismDataDestinations
Diagnostic settings to Event HubsResource logs, metrics, activity logSplunk, Elastic, Datadog, IBM QRadar, Sumo Logic
Native Azure ISV servicesMetrics and logs through native integrationDatadog, Dynatrace, New Relic, Elastic Cloud, Grafana
Log Analytics export rulesLog Analytics tables, continuouslyStorage account, Event Hubs
Microsoft SentinelSecurity logs in Log AnalyticsSIEM, detection and response
GrafanaAzure Monitor plugin (Metrics, Logs, Traces, Resource Graph)Grafana Cloud or self-hosted
Good practice: For a third-party tool, go through Event Hubs rather than polling the APIs: the stream is continuous, scalable and independent of the number of resources.

6. Costs and best practices #

Controlling ingestion.

Best practices #

  • Centralize logs in few Log Analytics workspaces (per environment or per region), with resource-context access control.
  • Choose the right table plan (Analytics, Basic, Auxiliary) and filter with DCR transformations.
  • Deploy diagnostic settings and DCR rules with Azure Policy to automatically cover new resources.
  • Instrument with the OpenTelemetry distro to stay portable.
  • Sample Application Insights telemetry on high-traffic applications.
  • Set a daily cap and cost alerts on ingestion.
Common mistake: Collecting « all logs » from every resource in the Analytics plan makes the bill explode: start with the useful categories.

Related articles

Understanding Azure: regions, resource hierarchy, tools and pricing

Microsoft Azure basics: geographies, regions, region pairs and availability zones, the hierarchy of managemen…

Microsoft Entra ID, RBAC and Azure Policy: identities, permissions and governance

Manage identities and access on Azure: Microsoft Entra ID (users, groups, MFA, conditional access), managed i…

Azure networking: VNet, NSG, peering, load balancing and hybrid connectivity

Design networking on Azure: virtual networks and subnets, network security groups (NSG), peering and hub-and-…

Keep learning

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!