Databases Azure SQL monitoring premium

Active connections

Active connections are the current database client sessions using a database service. For Azure SQL Database, Azure Monitor exposes this operational signal through metrics such as Sessions count and Sessions percentage, which help operators spot connection leaks, pool pressure, and client behavior that can affect availability.

Aliases
database active sessions, SQL sessions count, database connection count
Difficulty
intermediate
CLI mappings
5
Last verified
2026-05-08

Microsoft Learn

Active connections are the current database client sessions using a database service. For Azure SQL Database, Azure Monitor exposes this operational signal through metrics such as Sessions count and Sessions percentage, which help operators spot connection leaks, pool pressure, and client behavior that can affect availability.

Microsoft Learn: Supported metrics for Microsoft.Sql/servers/databases2026-05-08

Technical context

In Azure architecture, this term sits in the database reliability and operations layer. It connects application behavior, connection strings, private networking, Azure Monitor metrics, database tier limits, failover planning, readable secondaries, and operational runbooks. The control plane exposes database resources, replica links, alert rules, and monitoring configuration. The data plane shows how clients connect, query, replicate, and recover. A safe design always ties the term to the application pattern, because database metrics and replication settings only matter when interpreted against workload behavior and business recovery objectives. For Active connections, the important evidence is sessions count, sessions percentage, failed connections, workers percentage, CPU, application instance count, connection-string settings, and time correlation with deployments or traffic spikes. The metric is a signal, not the root cause by itself.

Why it matters

This matters because database problems usually surface as business outages before teams agree on the root cause. High sessions may come from connection leaks rather than compute shortage, and a replica may satisfy disaster recovery only if security, lag, failover steps, and application routing are already tested. The practical habit is to collect objective evidence, compare it with application design, and decide whether the next action is tuning, scaling, failover, rollback, or access correction. For Active connections, the most useful evidence is not the product label; it is the concrete output that shows current state, ownership, scope, and the next safe action.

Where you see it

Signals, screens, and Azure surfaces where this term usually becomes operational.

Signal 01

Azure SQL Database metrics

Signal 02

Azure Monitor dashboards

Signal 03

database performance troubleshooting

Signal 04

connection pool reviews

Signal 05

az monitor metrics commands

When this becomes relevant

Specific situations where this term helps solve real Azure design, operations, migration, security, reliability, cost, or governance problems.

  • Detect client connection leaks and pool exhaustion.
  • Correlate session count with failed connections and application scale-out.
  • Alert when database sessions stay high for sustained periods.
  • Avoid scaling compute when the real problem is connection behavior.

Real-world case studies

Different enterprise-style examples that show the term being used to hit measurable objectives.

Case study 01

Active connections in action

Scenario, objectives, solution, measured impact, and takeaway.

Scenario

ClearLake Travel saw intermittent login failures in its booking application, but CPU and DTU metrics looked normal during the incidents.

Business/Technical Objectives
  • Measure active database sessions during peak booking windows.
  • Detect connection pool exhaustion before customers failed to log in.
  • Tune application connection pooling without over-scaling the database blindly.
  • Create an alert for abnormal session growth.
Solution Using Active connections

The database team treated active connections as the number of active sessions reported through Azure SQL metrics such as `sessions_count` and `sessions_percent`. They used Azure Monitor metrics to compare session count, failed connections, workers, CPU, and application deployment times. The application team found that a recent release opened extra connections and failed to return them to the pool. Azure Monitor metric alerts were configured to notify the DBA action group when session percentage stayed high for more than five minutes. CLI-based metric checks became part of the release validation runbook, alongside application pool settings and database connection-string review.

Results & Business Impact
  • Login-related incidents dropped 81% after connection pooling was fixed.
  • The team avoided an unnecessary service-tier increase estimated at $42,000 per year.
  • High-session alerts gave DBAs 10 to 15 minutes of warning before customer impact.
  • Release validation now catches abnormal sessions in preproduction load tests.
Key Takeaway for Glossary Readers

Active connections help operators see whether database pressure is coming from client behavior, not just compute size.

Case study 02

Active connections in action

Scenario, objectives, solution, measured impact, and takeaway.

Scenario

UnionBank Digital ran a serverless-style customer profile database and noticed that idle connections prevented expected cost reductions during quiet hours.

Business/Technical Objectives
  • Identify clients holding sessions open after requests completed.
  • Reduce idle database activity outside business hours.
  • Preserve performance during morning traffic spikes.
  • Create a dashboard showing session count beside CPU and failed connections.
Solution Using Active connections

The operations team monitored active sessions using Azure SQL metrics and correlated them with application instances, connection strings, and deployment slots. They found that one background worker kept persistent connections open even when no jobs were running. The application team changed the worker to open connections only during job execution and tuned connection lifetime settings. Azure Monitor dashboards displayed `sessions_count`, `sessions_percent`, CPU, and failed connection metrics together so DBAs could distinguish connection pressure from query pressure. Alert thresholds were set cautiously to avoid paging on short, healthy bursts during batch windows. The runbook also recorded the owner, scope, verification command, rollback contact, and evidence to save after the change so operators could repeat the pattern safely.

Results & Business Impact
  • Idle session count during quiet hours dropped 72%.
  • Monthly database cost fell 14% after unnecessary activity was removed.
  • Morning traffic latency stayed within the 250 ms target.
  • The dashboard reduced connection-troubleshooting time from 2 hours to 25 minutes.
Key Takeaway for Glossary Readers

Active connections are a practical signal for spotting connection leaks and idle client behavior.

Case study 03

Active connections in action

Scenario, objectives, solution, measured impact, and takeaway.

Scenario

Atlas Marketplaces prepared for a holiday sale and needed confidence that Azure SQL connection capacity would not become the bottleneck before checkout traffic peaked.

Business/Technical Objectives
  • Load-test database session behavior before the sale.
  • Define alert thresholds for sustained active sessions.
  • Validate connection pool settings across API instances.
  • Avoid overreacting to short spikes that did not threaten availability.
Solution Using Active connections

The performance team ran staged load tests while watching Azure SQL `sessions_count`, `sessions_percent`, workers percentage, CPU, and failed connection metrics. They discovered that checkout APIs scaled out correctly, but each instance used a connection pool maximum that was too high for the database tier. Rather than scaling the database immediately, they lowered pool limits, added retry policy tuning, and tested again. Azure Monitor alerts were configured for sustained session percentage and user-correctable failed connections, routed through an action group that paged application and DBA responders together. The final runbook defined what session patterns required scale, code rollback, or pool adjustment.

Results & Business Impact
  • Peak sale traffic handled 2.8x normal volume without session exhaustion.
  • Database scale-up was avoided, saving about $9,500 for the event month.
  • Failed connection alerts stayed below the agreed threshold during checkout peaks.
  • Joint application-DBA response reduced incident handoff delay by 60%.
Key Takeaway for Glossary Readers

Active connections are most useful when interpreted with application scale and connection-pool design.

Why use Azure CLI for this?

Azure CLI is useful for Active connections because it turns portal-visible configuration into repeatable evidence. Operators can list the target, inspect IDs and state, confirm whether the command is read-only or mutating, and save sanitized output for release or incident records. For this term, CLI work should start with context checks such as tenant, subscription, resource group, registry, database, role scope, or resource ID. Use JSON output when tags, digests, receiver lists, token permissions, assignment scopes, metrics, or replica links matter. Treat commands that delete manifests, disable tokens, update scope maps, create alerts, or fail over databases as approval-required changes, not casual inspection.

CLI use cases

  • Inventory the current Active connections configuration before a release, access change, cleanup, alert update, or database operation so the operator can prove the target is correct.
  • Troubleshoot production behavior by comparing live Azure output for Active connections with the expected architecture, owner, scope, tag, permission, metric, or replica state.
  • Automate a repeatable verification check around Active connections in a pipeline or runbook so drift is caught before users, workloads, or auditors discover it.
  • Create sanitized post-change evidence for Active connections, keeping IDs, state, timestamps, digests, run IDs, metrics, or links while redacting secrets and sensitive endpoints.

Before you run CLI

  • Confirm the active tenant and subscription with `az account show`; many Active connections mistakes are wrong-context mistakes that look like product failures.
  • Identify the exact resource boundary before running commands: registry, repository, scope map, token, task, webhook, action group, role scope, database, or replica link.
  • Classify the command as read-only, security-impacting, cost-impacting, destructive, or availability-impacting; approval is required before mutating Active connections in production.
  • Decide how sensitive output will be handled before the command runs, especially token passwords, webhook URIs, object IDs, connection details, and registry metadata.

What output tells you

  • The output confirms whether Azure returned the intended Active connections target by name, resource ID, subscription, region, repository, database, role scope, or alert group.
  • State fields show what Azure will actually use: tags, digests, retention status, repository actions, token status, task triggers, receivers, session metrics, or replica links.
  • Nested JSON often contains the important evidence; table output can hide permissions, timestamps, action lists, credential status, endpoint scope, or metric dimensions.
  • The output also tells you whether the next action should be inspection, approval, rollback, scale, cleanup, failover, credential rotation, or a safer design review.

Mapped Azure CLI commands

Active connections commands

direct
az monitor metrics list-definitions --resource <database-resource-id>
az monitor metricsdiscoverDatabases
az monitor metrics list --resource <database-resource-id> --metric sessions_count --interval PT1M
az monitor metricsdiscoverDatabases
az monitor metrics list --resource <database-resource-id> --metric sessions_percent --interval PT1M
az monitor metricsdiscoverDatabases
az sql db show --name <database> --server <server> --resource-group <resource-group>
az sql dbdiscoverDatabases
az monitor metrics alert create --name <alert-name> --resource-group <resource-group> --scopes <database-resource-id> --condition 'avg sessions_percent > 80'
az monitor metrics alertprovisionDatabases

Architecture context

Use active connection monitoring to connect database pressure back to application behavior. Tune connection pools, retry policy, idle clients, private endpoint connectivity, and alert thresholds before assuming the database tier is too small. Save metric snapshots during incidents so teams can compare before and after behavior.

Security

Security depends on database identity, network, and access configuration matching the operational pattern. Connection metrics can expose application behavior, while geo-replication requires users, logins, firewall rules, private access, and permissions to work on the secondary after failover. For Active connections, verify who can connect, what endpoint they use, whether secrets are protected, and whether diagnostic evidence can be shared without leaking connection strings or sensitive workload details.

Cost

Cost can be direct or indirect. High active connections can lead teams to scale a database when the actual fix is connection-pool tuning, while geo-replication adds secondary database cost that must be justified by RTO, RPO, read-scale, and business impact. For Active connections, cost review should compare tuning, scaling, alerting, and replication against the measurable business risk of outage or performance failure.

Reliability

Reliability depends on recognizing whether the term represents pressure, redundancy, or recovery capability. High active sessions can precede failed logins, while a geo-secondary only helps if replication, security, monitoring, and application routing are tested. For Active connections, operators should define thresholds, failover criteria, rollback steps, and evidence such as session trends, replication links, lag, health metrics, and successful access checks.

Performance

Performance depends on workload interpretation. Active sessions, failed connections, workers, CPU, and query behavior must be read together before deciding to scale or roll back. Geo-replication can offload read-only work, but asynchronous replication means lag and routing matter. For Active connections, performance review should include application pool settings, latency targets, replica lag, read workload placement, and whether alert thresholds represent sustained pressure rather than harmless bursts.

Operations

Operational excellence means database behavior is observed with repeatable commands and dashboards rather than guesses. Use Azure Monitor metrics, SQL resource commands, replica commands, and alert rules to capture state before and after changes. For Active connections, the runbook should name the database, server, resource ID, metric or replica field, expected healthy value, owner, escalation path, and exact output to save for incident review.

Common mistakes

  • Treating Active connections as a label instead of a boundary with owner, scope, evidence, and rollback consequences.
  • Running mutating commands from the wrong subscription, resource group, registry, role scope, database, or region because the Azure CLI context was not checked first.
  • Saving raw secrets, token passwords, webhook URLs, or sensitive identity details in tickets instead of sanitized operational evidence.
  • Assuming a successful command proves the design is correct; it only proves Azure accepted the request or returned the current state.