Skip to main content
emnode
Site Reliability

Turn on zone redundancy for Cosmos DB regions

A Cosmos DB region without zone redundancy can park all of its replicas in one datacentre, so a single availability-zone outage takes the region offline. Spreading those replicas across zones keeps the account serving reads and writes while one zone is down, and on most accounts it costs nothing extra.

14 min·10 sections·AZURE

Last reviewed

Zone redundancy for Cosmos DB: the basics

What does a region without zone redundancy actually expose you to?

An availability zone is a physically separate group of datacentres within an Azure region, each with its own power, cooling and network. A region typically has three of them, and a zonal outage, a power or cooling fault in one zone, is a far more common event than a whole region failing. Cosmos DB keeps four replicas of your data behind each region. When zone redundancy is off, those replicas can all sit in a single availability zone, which Microsoft does not reveal to you, so if that one zone has an outage the region loses read and write availability until the zone recovers. When zone redundancy is on, Cosmos DB distributes the replicas across multiple zones, and the region keeps serving traffic while any single zone is down.

Azure Advisor surfaces this as a reliability recommendation, 'Enable zone redundancy for multi-region Cosmos DB accounts', because the gap is invisible until the day a zone fails. The account looks healthy, throughput is fine, latency is fine, and nothing in normal operation tells you that every replica for a region is one datacentre away from going dark together. Zone redundancy is the setting that turns a zonal outage from an availability incident into a non-event the platform handles for you, with no failover to initiate and no application code to change.

The important detail is that zone redundancy is configured per region, not per account. A Cosmos DB account can span several Azure regions, and each one is enabled, or not, independently. Some older regions do not support availability zones at all, but that never blocks you from enabling zone redundancy on the regions that do. So the work is not one switch: it is finding every region on every account that could be zone redundant and is not, and deciding which to fix.

In this lesson you will learn how Cosmos DB places replicas across availability zones, why a region without zone redundancy is exposed to a single zonal outage, how to find every region on every account that could be zone redundant and is not, and how to enable it safely, including the migration path for regions that already exist. Because zone redundancy can only be set when a region is added, the safe sequence matters and is covered step by step.

Fun fact

Four replicas, possibly one room

Cosmos DB keeps four replicas of your data in every region for durability, which sounds like plenty of resilience until you learn that, without zone redundancy, all four can live in the same availability zone, and Microsoft deliberately does not tell you which one. Four copies in one datacentre protect you from a disk or a node failing; they do nothing for the whole zone losing power. Turning zone redundancy on is what spreads those copies across separate datacentres, and Microsoft applies synchronous replication across the zones so quorum is maintained, which is why a zone can drop without losing committed data and usually without you noticing more than a few seconds of redistribution.

Finding non-zone-redundant Cosmos DB regions across a subscription

Priya runs the platform team at a payments business. Azure Advisor has raised a reliability recommendation against the Cosmos DB account behind the checkout service, flagging that its regions are not zone redundant.

Before changing anything on a live database, Priya lists every Cosmos DB account and inspects the zone-redundancy flag on each of its regions, so she can separate the genuinely exposed accounts from the ones already protected and the ones in regions that cannot support zones at all.

List each account's regions with their zone-redundancy flag. A region showing False is one zonal outage away from going dark.

$ az cosmosdb list --query "[].{name:name, group:resourceGroup, regions:locations[].{r:locationName, az:isZoneRedundant}}" -o json
[
{ "name": "checkout-prod", "group": "rg-payments",
"regions": [ { "r": "West Europe", "az": false } ] },
{ "name": "catalog-prod", "group": "rg-shop",
"regions": [ { "r": "North Europe", "az": true } ] }
]
# checkout-prod: single region, zone redundancy off. Highest-value fix.

A single-region account with isZoneRedundant false is the highest-priority target: one zonal outage takes the whole database offline. Fix the revenue-bearing accounts first.

How Cosmos DB places replicas, and why Advisor flags the gapdeep dive

Each region in a Cosmos DB account holds a replica set of four replicas. With zone redundancy disabled the region is nonzonal: the platform may place all four replicas in a single availability zone, and you cannot see or choose which one. A power, cooling or network fault in that zone then takes the region's read and write availability with it until the zone recovers. With zone redundancy enabled, Cosmos DB spreads the replicas across separate availability zones and applies synchronous replication between them to hold quorum, so a single zone can drop without losing committed writes. When a zone fails, the platform detects it, terminates in-flight requests to the affected replicas, and reroutes traffic to healthy replicas in the surviving zones automatically; the application just retries, exactly as it should for any transient fault.

Azure Advisor evaluates this from the account's location configuration: the per-region 'isZoneRedundant' flag. When it is false on a region that sits in an availability-zone-capable region, Advisor raises the reliability recommendation to enable it. The flag is the same property you see in the CLI, in Bicep and ARM templates, and as the 'Availability Zone' toggle in the portal. Because the flag is per region, a multi-region account can legitimately show a mix: redundant where it can be, nonzonal where the region has no zones to spread across.

The constraint that shapes all the remediation work is that 'isZoneRedundant' can only be set when a region is added to the account. It is not a property you can flip in place on a region that already exists. That is why making an existing region zone redundant is a migration, not an edit: you add a temporary region, move the write workload to it, remove the original region, and add it back with zone redundancy on. Single-region serverless accounts are stricter still, they can only be made zone redundant at creation time, which is why Microsoft steers mission-critical workloads to provisioned throughput.

What is the impact of leaving a region non-zone-redundant?

The direct impact is availability. A nonzonal region can have all four of its replicas in one availability zone, so a single zonal outage, the most common kind of datacentre failure short of a full region loss, removes read and write access to that region until the zone is restored. For a single-region account that is a total outage of the database. For a multi-region account it means losing that region's local availability and leaning on the others, with whatever latency and failover behaviour that implies. None of this requires the dramatic scenario of a whole region failing; it only takes one datacentre having a bad day.

The second-order impact is everything that database sits under. Cosmos DB rarely fails alone: it backs a checkout, an auth service, a session store or an order pipeline, so its unavailability cascades into the user-facing service. The cost of that downtime, lost transactions, support load, customer churn, accrues for the full duration of the zone impairment, which is outside your control. Zone redundancy converts that from an outage you wait out into a few seconds of request redistribution the platform handles for you.

On the resilience and assurance side, an Azure Advisor reliability recommendation against a production database is exactly the kind of finding that looks negligent in hindsight after an outage. A clean reliability posture on the accounts that back revenue, every zone-capable region zone redundant, is a cheap and defensible artefact: it shows the single most common regional failure mode was designed out rather than left to chance.

How do you enable zone redundancy safely?

Work it as a per-region decision, and respect the one hard rule: zone redundancy can only be set when a region is added, never edited in place. New accounts get it for free at creation; existing regions need a careful migration so you never drop the write workload.

1. Inventory every region by its zone-redundancy flag

List every Cosmos DB account and the 'isZoneRedundant' flag on each of its regions. A region showing false in an availability-zone-capable region is the gap Advisor is flagging. Treat this inventory as the source of truth, and prioritise by what each account sits under, not by the order Advisor lists them.

2. Set it at creation for anything new

For new accounts and new regions, enable zone redundancy up front: it is a single flag at deploy time, with no migration and, on autoscale or multi-region-write accounts, no premium. In the portal it is the Availability Zones toggle; in the CLI, Bicep and ARM it is 'isZoneRedundant'. This is the cheapest possible moment to do it, so make it the default for production.

3. Migrate existing regions without dropping writes

Because the flag cannot be flipped in place, making an existing region zone redundant is a migration: add a temporary region, fail the write workload over to it, remove the original region, then add it back with zone redundancy on and fail back. Expect a few seconds of write unavailability as the platform checks cross-region consistency during the add and remove, and a short-lived cost for the temporary region and its replication. Plan it in a maintenance window.

4. Hold the line with policy and Advisor

Keep the Azure Advisor reliability recommendation in view so any new non-redundant production region is caught, and where you template deployments, bake 'isZoneRedundant: true' into the Bicep or ARM module so new regions are zone redundant by default rather than by memory. The goal is that the safe configuration is the one you get without thinking about it.

# Enabling zone redundancy on an EXISTING region is a migration: the flag
# can only be set when a region is added, never edited in place. The safe
# sequence adds a temporary region, fails over, then re-adds the original
# with zone redundancy on. Include ALL existing regions in every call.

ACCOUNT=checkout-prod
RG=rg-payments

# 1. Add a temporary region (West US) alongside the existing one (East US).
az cosmosdb update --name "$ACCOUNT" --resource-group "$RG" \
  --locations regionName=eastus failoverPriority=0 isZoneRedundant=False \
  --locations regionName=westus failoverPriority=1 isZoneRedundant=False

# 2. Wait for West US to show as Available, then fail writes over to it.
az cosmosdb failover-priority-change --name "$ACCOUNT" --resource-group "$RG" \
  --failover-policies westus=0 eastus=1

# 3. Remove the original region so it can be re-added zone redundant.
az cosmosdb update --name "$ACCOUNT" --resource-group "$RG" \
  --locations regionName=westus failoverPriority=0 isZoneRedundant=False

# 4. Add East US back WITH zone redundancy enabled.
az cosmosdb update --name "$ACCOUNT" --resource-group "$RG" \
  --locations regionName=westus failoverPriority=0 isZoneRedundant=False \
  --locations regionName=eastus failoverPriority=1 isZoneRedundant=True

# 5. Fail writes back to the now zone-redundant region, then remove the temp.
az cosmosdb failover-priority-change --name "$ACCOUNT" --resource-group "$RG" \
  --failover-policies eastus=0 westus=1
az cosmosdb update --name "$ACCOUNT" --resource-group "$RG" \
  --locations regionName=eastus failoverPriority=0 isZoneRedundant=True

# --- For NEW accounts/regions, zone redundancy is free of migration. ---
# Bake it into the locations array in Bicep so it is the default:
#
# resource account 'Microsoft.DocumentDB/databaseAccounts@2024-11-15' = {
#   name: 'checkout-prod'
#   location: 'eastus'
#   properties: {
#     databaseAccountOfferType: 'Standard'
#     locations: [
#       {
#         locationName: 'eastus'
#         failoverPriority: 0
#         isZoneRedundant: true
#       }
#     ]
#   }
# }

Quick quiz

Question 1 of 5

Without zone redundancy, where can Cosmos DB place the four replicas it keeps in a region?

You can now treat Cosmos DB zone redundancy as a per-region reliability decision rather than a single switch: inventory every region by its isZoneRedundant flag, set it for free at creation on anything new, migrate existing regions carefully because the flag cannot be edited in place, and keep Advisor and your templates holding the line. The one rule to remember is that zone redundancy is set when a region is added, never afterwards, so the migration sequence exists to enable it without dropping your write workload.

Back to the library