Databases Data platform field-manual-complete

Preferred regions

Preferred regions are the ordered list of Azure regions a Cosmos DB application wants to use first. In a multi-region Cosmos DB account, the SDK checks which regions the account actually has and then chooses the best matching endpoint from the application’s list. This helps an app in Europe read from Europe while an app in North America reads from North America. It is a client configuration, not just an account setting, and it must match the account’s real regions to work as intended.

Aliases
No aliases mapped yet
Difficulty
intermediate
CLI mappings
5
Last verified
2026-05-20

Microsoft Learn

Preferred regions are the ordered Azure regions that an Azure Cosmos DB SDK client uses when connecting to a geo-replicated account. The SDK intersects the configured list with account regions and routes reads, and in multi-write accounts writes, by that preference order.

Microsoft Learn: Diagnose and troubleshoot Azure Cosmos DB SDK availability in multiregion environments2026-05-20

Technical context

In Azure architecture, preferred regions live at the Cosmos DB client and SDK configuration layer. The account defines available write and read regions through the control plane, while the application sets preferred region order in code or configuration. During initialization and refresh, the SDK discovers account regions, intersects them with the configured list, and routes operations based on account type, availability, and consistency rules. The concept touches global distribution, latency, failover behavior, multi-region writes, diagnostics, networking, and application deployment topology. Operators inspect account locations with CLI, but developers configure preferences in the client.

Why it matters

Preferred regions matter because global distribution only helps when clients actually use the right regional endpoints. Without a correct preference list, an application can send reads across an ocean, increase latency, pay unnecessary data-transfer costs, or fail over in an order that does not match user geography. The setting also prevents misunderstandings during incidents: the account may have several regions, but each SDK client follows its own configured order. For multi-write accounts, write routing decisions depend on SDK behavior and preferred regions as well. Teams need to align application deployment regions, Cosmos DB account regions, consistency requirements, and failover expectations before users feel the difference.

Where you see it

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

Signal 01

Application configuration or SDK initialization shows the ordered preferred regions list, application region, or region-specific connection option used by the client at startup and failover planning.

Signal 02

The Cosmos DB Replicate data globally blade shows account regions and failover priority, which must align with application preferred-region choices before release and topology review.

Signal 03

SDK diagnostics and Azure Monitor latency metrics reveal which regional endpoint handled requests and whether fallback occurred during regional issues or failover drills during controlled tests.

When this becomes relevant

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

  • Route European application instances to a nearby Cosmos DB read region instead of sending routine reads to a distant primary region.
  • Define an explicit regional fallback order before a business-continuity drill so failover behavior matches the recovery plan.
  • Support multi-region writes by aligning SDK configuration with regions where the application is deployed and allowed to write.
  • Detect configuration drift when staging, production, or regional app deployments use different Cosmos DB region preference lists.
  • Reduce unnecessary latency and cross-region traffic by matching user geography, app hosting region, and Cosmos DB account replication.

Real-world case studies

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

Case study 01

Gaming backend lowers regional read latency

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

Scenario

A multiplayer gaming studio replicated Cosmos DB data to North America and Europe, but European game clients still showed high profile-read latency during evening peaks.

Business/Technical Objectives
  • Route European application instances to the nearest healthy Cosmos DB region.
  • Keep North American instances using their local preference order.
  • Verify SDK diagnostics during a regional failover drill.
  • Avoid adding compute before proving routing was correct.
Solution Using Preferred regions

Developers updated the Cosmos DB SDK configuration so each regional backend deployment had its own preferred region order. The European App Service slot listed West Europe first, then North Europe, then the North American fallback. The North American deployment used its own local order. Operators used Azure CLI to export the Cosmos DB account locations and failover priorities, proving the configured preferences matched actual account regions. During a drill, SDK diagnostics confirmed requests moved down the European preference list when the first region was made unavailable. Latency dashboards were split by deployment region so routing improvements were visible.

Results & Business Impact
  • European profile-read p95 latency dropped from 185 milliseconds to 74 milliseconds.
  • The team avoided a planned backend scale-up because the bottleneck was regional routing.
  • Failover diagnostics proved the SDK used the designed fallback order.
  • Regional dashboards gave support teams clear evidence of endpoint selection during incidents.
Key Takeaway for Glossary Readers

Preferred regions make Cosmos DB global distribution practical by aligning each application deployment with the closest healthy database replica.

Case study 02

Travel booking platform tests failover order

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

Scenario

A travel booking platform ran search personalization services in three continents. The Cosmos DB account had multiple regions, but failover behavior differed between application teams.

Business/Technical Objectives
  • Standardize regional preference order for each application deployment.
  • Ensure fallback regions had enough throughput during a regional incident.
  • Document the difference between account failover priority and SDK preference.
  • Reduce incident confusion when traffic moved between regions.
Solution Using Preferred regions

The architecture group reviewed every personalization service and found several hard-coded region lists. They moved preferred regions into environment-specific configuration and used Azure CLI to show each Cosmos DB account’s locations, write locations, consistency level, and failover priorities. Load tests simulated a regional outage while SDK diagnostics recorded contacted endpoints and retries. The team adjusted throughput allocations in fallback regions and created a runbook explaining how SDK preference interacts with account configuration. Deployment validation failed builds if an application listed a region not present on the Cosmos DB account.

Results & Business Impact
  • Regional failover tests completed without personalization service errors above the agreed threshold.
  • Invalid region names were removed from four application configurations.
  • Fallback-region throughput was increased before the next holiday booking surge.
  • Incident calls became shorter because teams could explain whether routing came from SDK preference or account failover.
Key Takeaway for Glossary Readers

Preferred regions prevent global Cosmos DB designs from depending on unclear client behavior during the exact moments teams need predictability.

Case study 03

Industrial IoT dashboard avoids cross-region reads

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

Scenario

An industrial IoT provider served equipment dashboards for factories in Asia Pacific and North America. Operators noticed slow dashboard refreshes even though Cosmos DB was globally replicated.

Business/Technical Objectives
  • Match dashboard application instances with nearby Cosmos DB read regions.
  • Reduce cross-region request paths that increased latency and data-transfer cost.
  • Keep failover order consistent with factory support coverage.
  • Use diagnostics to prove routing before changing database capacity.
Solution Using Preferred regions

The platform team compared AKS deployment regions with Cosmos DB account locations using Azure CLI. They discovered the Asia Pacific dashboard used a default client configuration and often read from a North American region. Developers set preferred regions per deployment through Kubernetes configuration, placing the nearest Asia Pacific region first and a supportable secondary region second. SDK diagnostics were emitted to application logs, showing selected endpoints and retry movement. Network and private endpoint rules were reviewed so the preferred paths were reachable. Only after routing was corrected did the team revisit throughput and indexing recommendations.

Results & Business Impact
  • Dashboard refresh p95 latency in Asia Pacific improved by 58 percent.
  • Cross-region read traffic dropped 44 percent in the first month.
  • Support teams gained endpoint diagnostics for every regional dashboard incident.
  • The database capacity review avoided unnecessary RU increases caused by routing delay symptoms.
Key Takeaway for Glossary Readers

Preferred regions are a client-side performance and reliability control that must be reviewed whenever application deployments span geographies.

Why use Azure CLI for this?

As an Azure engineer with ten years of global application work, I use Azure CLI for preferred regions to validate the Cosmos DB account side of the design. The actual preference list is usually in application code or configuration, but CLI tells me which regions the account offers, which region is writable, and how failover priorities are arranged. That evidence prevents developers from configuring regions the account does not have. It also helps incident teams compare client diagnostics with account locations during regional events, instead of guessing why traffic moved. It turns routing debates into verifiable configuration evidence during drills and incidents.

CLI use cases

  • Show Cosmos DB account locations and failover priorities before approving an SDK preferred-region list.
  • List accounts across resource groups to find globally distributed databases that need application-region review.
  • Compare account region configuration with App Service, AKS, or Function App deployment regions during architecture audits.
  • Export account JSON after adding or removing a region so application teams can update their preference order safely.
  • Check account consistency, multi-write setting, and write locations while investigating unexpected regional routing.

Before you run CLI

  • Confirm tenant, subscription, resource group, Cosmos DB account name, API type, application deployment region, and consistency requirement.
  • Remember CLI can inspect account regions, but SDK preferred regions are configured in application code or settings.
  • Review cost and latency impact before adding regions or changing failover order just to satisfy one client preference.
  • Use JSON output so developers can compare locations, failover priorities, and write regions against the application configuration.
  • Coordinate with networking owners if private endpoints, firewall rules, or regional network paths affect which endpoint clients can reach.

What output tells you

  • Locations output shows which regions the account actually exposes, so invalid SDK preferences can be identified quickly.
  • Write location fields show where writes are accepted for single-write accounts and how multi-write behavior should be reviewed.
  • Failover priority values reveal the account-level regional order, which may differ from each application client preference list.
  • Consistency and multi-write settings help explain why reads, writes, or failover behavior differ between clients.
  • Resource IDs and tags confirm whether the inspected account matches the application environment involved in an incident.

Mapped Azure CLI commands

Cosmos DB regional configuration inspection

adjacent
az cosmosdb show --name <account-name> --resource-group <resource-group>
az cosmosdbdiscoverDatabases
az cosmosdb list --resource-group <resource-group>
az cosmosdbdiscoverDatabases
az cosmosdb show --name <account-name> --resource-group <resource-group> --query locations
az cosmosdbdiscoverDatabases
az cosmosdb show --name <account-name> --resource-group <resource-group> --query writeLocations
az cosmosdbdiscoverDatabases
az cosmosdb failover-priority-change --name <account-name> --resource-group <resource-group> --failover-policies <region=priority>
az cosmosdboperateDatabases

Architecture context

As an Azure architect, I treat preferred regions as the bridge between Cosmos DB global distribution and application placement. The account may replicate data to several regions, but the application still needs an intentional regional order. I expect each deployed app instance to know its nearest healthy region, a secondary fallback, and whether multi-write is enabled. This belongs in application configuration, not hard-coded guesses. The design should also account for SDK refresh behavior, diagnostics, consistency level, private networking, and regional failover tests. During architecture reviews, I ask whether the app and database regions line up with user traffic, not just whether the account has extra regions.

Security

Security impact is indirect. Preferred regions do not grant access, change keys, modify RBAC, or alter encryption. The risk appears in data residency, network exposure, and diagnostics. If an application routes to an unintended region, operational data may cross boundaries that architects expected to avoid. Private endpoints, firewall rules, managed identity paths, and connection strings must still be valid for the regions the application can use. Teams should also protect SDK configuration because changing region order can affect traffic paths and incident behavior. Security reviews should confirm allowed regions, account replication choices, private network design, secret handling, and logging of regional endpoint selection.

Cost

Cost impact is indirect but real. Preferred regions can reduce latency and unnecessary cross-region traffic when clients read from nearby replicated regions. A poor region order can route requests through distant endpoints, increase network costs, raise user-facing latency, and encourage overprovisioning to compensate for avoidable delay. Multi-region accounts also have replication and throughput costs, so adding regions without configuring clients properly wastes money. FinOps reviews should compare account region count, application deployment locations, request volumes, data transfer, and latency. Preferred regions should be part of the business case for global distribution, not an afterthought left to default SDK behavior across teams.

Reliability

Reliability impact is direct for multi-region applications. Preferred regions tell the SDK which regional endpoint to try first and which endpoint to use next when a region becomes unavailable. If the list is wrong, failover can send traffic to a distant region, a region the account does not use, or a fallback path the application has never tested. The SDK ignores configured regions that are not available in the account, so operators must verify both code and account configuration. Reliable use requires regional drills, connection diagnostics, retry tuning, consistency review, and enough throughput in surviving regions to absorb redirected traffic during failover.

Performance

Performance impact is direct because regional endpoint choice affects latency, retries, and user experience. The closest healthy Cosmos DB region usually gives lower round-trip time for reads, while the wrong preferred order can make every query slower even when the database has a local replica. During regional problems, the SDK can move down the preference list, so performance depends on fallback order and available throughput. Operators should monitor latency, diagnostics, retries, request charge, throttling, and client region selection. Performance testing should run from each application deployment region because one global preference list may not be right for every geography or client workload.

Operations

Operators manage preferred regions by comparing application configuration with Cosmos DB account locations, SDK diagnostics, deployment slots, environment variables, and regional traffic metrics. The Azure CLI can show account write and read regions, but it cannot prove every app instance configured the right SDK list without checking application settings or code. Incident review should inspect client diagnostics to see which region handled requests and why failover occurred. Change procedures should update app configuration and Cosmos DB regions together. Monitoring should include latency by region, request charge, availability, throttling, endpoint failover, and whether deployments in different geographies use different preference orders.

Common mistakes

  • Setting preferred regions in code that are not actually configured on the Cosmos DB account.
  • Assuming account failover priority and SDK preferred-region order are always the same thing.
  • Using one global preference list for application instances deployed in several continents.
  • Ignoring SDK diagnostics, then blaming Cosmos DB when the client chose a distant fallback region correctly.
  • Adding account regions for resilience but never updating application configuration to use them effectively.