'Ways to enable isZoneRedundant flag in existing region of CosmosDB

Can anyone advise an approach to enable isZoneRedundant for the existing CosmosDB region?

I think one way could be (say we need it in region A):

  • Add another region B
  • Remove region A
  • Add region A with isZoneRedundant enabled
  • Remove region B

Thank you very much,



Solution 1:[1]

The only way to make a region zone redundant after it has already been added to the account is to add a second region, then do a regional failover to that second region, remove the original write region, add it back with zone enabled, then fail over again to the newly added region.

Regional failover is a POST operation so must be done with PowerShell or CLI script. There are examples for azure cli and for PowerShell. These samples also have examples for adding and removing regions as well.

Solution 2:[2]

Your own and Mark Brown's answer is correct

Here is the formal MS doc for it https://docs.microsoft.com/en-us/azure/cosmos-db/high-availability

Zone redundancy can only be configured when adding a new region to an Azure Cosmos account. For existing regions, zone redundancy can be enabled by removing the region then adding it back with the zone redundancy enabled. For a single region account, this requires adding a region to temporarily fail over to, then removing and adding the desired region with zone redundancy enabled.

A note for Terraform users. The terraform plan won't even notice the change/adding of the zone_redundant = true parameter. I thought something was wrong but it probably should error instead of showing no change. You can do the same operation via terraform by running multiple applies to add, remove, re-add with zone_redundant = true. Or do it manually and then do a terraform apply -refresh-only (note: I haven't tried this for zone_redundant, I was using for geo_locations)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mark Brown
Solution 2 Douglas Young