Domain 2 of 3 · Chapter 2 of 4

Implement availability and recovery solutions

Unlock the complete study guide + 25 practice exams totaling 1,500 questions.

Bundled into the existing Building AI Applications with Azure Cosmos DB premium course — no separate purchase.

14-day refund guarantee on one-time purchases and your first subscription charge.

Included in this chapter:

  • Backups and regions protect against different failures
  • Scheduling and retaining periodic backups
  • Where periodic backups are stored
  • Restoring from a periodic backup
  • Continuous backup mode: tiers, timing and cost
  • Migrating an account to continuous backup
  • Choosing a restore target: new account or same account
  • Finding the restore point in the restorable inventory
  • Permissions for a point-in-time restore
  • Restoring into a new account
  • Restoring deleted databases and containers in place
  • Adding read regions to a single-write account
  • Zone redundancy within a region
  • Configuring multi-region writes
  • Resolving write conflicts
  • Four ways to fail over a single-write account
  • What a regional outage costs: availability and data loss
  • Running a forced failover, failing back and drilling it
  • How per-partition automatic failover works
  • Enabling and testing PPAF
  • Recognizing availability and recovery scenarios

Failover mechanisms for a single-write, multi-region account

QuestionPer-partition automatic failover (PPAF)Forced failover (Offline region)Change write regionService-managed failover
Who triggers itAzure Cosmos DB, for each affected partitionYou, after you detect the outageYou, as a planned operationMicrosoft, after it declares the outage
What movesOnly the affected partitionsThe account's write regionThe account's write regionThe account's write region
Usable during a regional outageYes, automaticYes, the fast path you controlNo, it needs healthy regionsYes, but it can take an hour or more
Unreplicated writes (non-strong consistency)Divergent writes reconciled by last-writer-wins on failbackCan be lostNone lost; replication catches up firstCan be lost
FailbackAutomatic, with incremental catch-upYou change the write region backNot applicable (planned move)You change the write region back

Decision tree

Every region mustaccept writes?YesMulti-regionwritesNoPlanned move betweenhealthy regions?YesChange writeregionNoPPAF enabled on asupported account?YesPPAF fails overautomaticallyNoRestore writesyourself, now?YesForced failover(Offline region)NoService-managedfailover enabled?YesService-managedfailover (slow)NoWrites stay down

Cheat sheet

  • Periodic backup uses support-assisted snapshot recovery rather than self-service point-in-time restore
  • Periodic mode takes a full backup every four hours and retains two backups by default
  • Periodic backup scheduling has bounded interval and retention settings
  • Deleted periodic-backup containers and databases retain existing snapshots for thirty days
  • Periodic backup defaults to geo-redundant storage but can remain within one region
  • The first two periodic backup copies are included and extra copies are billed
  • Periodic recovery restores a new single-region account in the source write region
  • Retained native backups cannot be modified, directly deleted, or disabled by customers
  • Native background backups do not consume the application's provisioned RUs
  • CosmosBackupOperator authorizes periodic-backup restoration requests
  • Continuous backup offers fixed seven-day, thirty-day, and thirty-five-day retention tiers
  • Seven-day continuous backup has no backup-storage charge but restores are billed in every tier
  • Migration from periodic to continuous backup cannot be reversed
  • An unspecified migration tier defaults to thirty-day continuous backup
  • Continuous backup is local to each configured account region
  • The latest restorable timestamp is specific to the resource and region
  • Continuous backup normally persists mutations asynchronously within one hundred seconds
  • Continuous backup supports NoSQL, MongoDB, Gremlin, and Table accounts but not Cassandra
  • Customer-managed-key migration needs a Key Vault-authorized default identity
  • A new-account restore recovers data and index properties rather than all application artifacts
  • Restoring to a new account does not recreate the source security perimeter or regional topology
  • A shared-throughput database must be restored as a whole
  • Restore targets stay within the source subscription and eligible backup regions
  • Disable TTL during restore when recovered items must not expire immediately
  • Continuous restore requires source restore permission and destination account creation permission
  • Source restore privileges are scoped to a restorable account or subscription rather than a resource group
  • Periodic recovery generates new account keys for the restored account
  • Periodic restoration excludes documents deleted by expired TTL
  • Periodic restoration does not restore materialized views
  • Account-level continuous recovery specifies the source instance and a new destination account
  • Restore discovery requires read permissions on the restorable source resources
  • An ARM-based restore also needs destination deployment permissions
  • Keep relevant IAM policies unchanged while continuous restoration runs
  • Multi-write recovery includes only mutations confirmed by the hub at the restore point
  • Restoring a multi-write collection resets its custom conflict policy to timestamp-based LWW
  • A restored collection may still be rebuilding its consistent index
  • Continuous restore does not guarantee historical throughput configuration
  • A new account restored from continuous backup retains the source consistency setting
  • Same-account restore recovers deleted resources rather than rolling back a live corrupted container
  • The restorable event feed identifies the deleted resource version and valid restore time
  • Same-account NoSQL restore uses the database restore or container restore command
  • Restore a missing parent database before its deleted child container
  • One account permits at most three active same-account restore operations
  • Deleting the source account can fail an in-progress restore
  • A same-account restored container becomes Online only after asynchronous recovery completes
  • The InAccount Restore Deleted Activity-log operation identifies same-account recovery
  • Additional read regions add regional cost rather than free replica capacity
  • Multi-region writes serve active writers near their regional application instances
  • A newly added region becomes available only after existing data has replicated there
  • Availability-zone protection is configured independently for each account region
  • Healthy regions need capacity for traffic redirected from a failed region
  • Secondary read regions do not become local writers in a single-write account
  • Existing-region zone protection generally requires a regional migration procedure
  • Serverless zone redundancy must be selected at account creation
  • Multi-write accounts and autoscale collections are exempt from the zone-redundancy premium
  • Region removal must preserve an eligible writer and at least one account region
  • Multi-write outage recovery routes reads and writes to healthy regions
  • Concurrent regional writes can produce insert, replace, and delete conflicts
  • Last-writer-wins chooses the highest conflict-resolution value
  • A delete wins a last-writer-wins delete conflict regardless of the numeric path
  • A custom merge stored procedure applies application-defined conflict semantics on the server
  • Custom resolution without a merge procedure sends conflicts to the conflict feed
  • Custom conflict resolution must be chosen when a NoSQL container is created
  • Service-managed failover promotes a secondary region according to account priorities
  • Change write region is a planned operation that requires healthy communicating regions
  • Avoid unrelated control-plane changes to an affected account during regional recovery
  • Strong-configured regional failover preserves acknowledged writes while weaker configurations can lose unreplicated writes
  • An account-level failed-over write region does not automatically reclaim writes on recovery
  • Read-region outages are normally handled by SDK regional routing rather than promoting a new writer
  • Forced failover takes an unavailable region offline without waiting for service-managed recovery
  • A secondary-region outage can block writes in a two-region Strong account
  • An extended read-region outage can exhaust Bounded Staleness write availability
  • Session, Consistent Prefix, and Eventual regional-outage RPO is less than fifteen minutes
  • Bounded Staleness regional-outage RPO follows its configured K and T bounds
  • A regional recovery drill uses forced failover and restores the intended failover configuration afterward
  • Regional offline and online operation metrics identify the region and operation status
  • The conflict feed exposes unreplicated writes after ordinary write-region recovery
  • PPAF requires a provisioned NoSQL account with one writer and at least one read region
  • PPAF does not support Bounded Staleness or switching between Strong and non-Strong while enabled
  • Every application instance must use a PPAF-capable SDK before account enablement
  • PPAF must be disabled before partition merge or region-offline operations
  • PPAF is an account feature in the Business Critical tier
  • PPAF's documented connection-mode prerequisite is Direct
  • PPAF is currently available in Azure public-cloud regions
  • PPAF redirects only affected partitions and leaves healthy writers in place
  • PPAF selects a recovery replica using account priorities and replica freshness
  • PPAF-capable SDKs refresh partition-to-region routing without changing the account endpoint
  • PPAF automatically fails back with incremental catch-up rather than a full rebuild
  • PPAF reconciles weaker-consistency divergence with timestamp-based last-writer-wins by default
  • PPAF can temporarily downshift a two-region Strong write quorum during failure
  • PartitionWriteGlobalStatus shows where write partitions currently reside
  • PPAF failure simulation affects a bounded subset of a container's partitions
  • PPAF enables a client-side partition circuit breaker for read availability

Unlock with Premium — includes all practice exams and the complete study guide.

References

  1. https://learn.microsoft.com/en-us/azure/reliability/reliability-cosmos-db-nosql
  2. https://learn.microsoft.com/en-us/azure/cosmos-db/consistency-levels
  3. https://learn.microsoft.com/en-us/azure/cosmos-db/continuous-backup-restore-introduction
  4. https://learn.microsoft.com/en-us/azure/cosmos-db/periodic-backup-restore-introduction
  5. https://learn.microsoft.com/en-us/azure/cosmos-db/online-backup-and-restore
  6. https://learn.microsoft.com/en-us/azure/cosmos-db/periodic-backup-modify-interval-retention
  7. https://learn.microsoft.com/en-us/cli/azure/cosmosdb
  8. https://learn.microsoft.com/en-us/azure/cosmos-db/periodic-backup-update-storage-redundancy
  9. https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles/databases
  10. https://learn.microsoft.com/en-us/azure/cosmos-db/migrate-continuous-backup
  11. https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-restore-in-account-continuous-backup
  12. https://learn.microsoft.com/en-us/azure/cosmos-db/restore-account-continuous-backup
  13. https://learn.microsoft.com/en-us/azure/cosmos-db/continuous-backup-restore-permissions
  14. https://learn.microsoft.com/en-us/azure/cosmos-db/monitor-reference
  15. https://learn.microsoft.com/en-us/azure/cosmos-db/per-partition-automatic-failover
  16. https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/manage-with-cli
  17. https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-manage-database-account
  18. https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-multi-master
  19. https://learn.microsoft.com/en-us/azure/cosmos-db/performance-tips-dotnet-sdk-v3
  20. https://learn.microsoft.com/en-us/azure/cosmos-db/multi-region-writes
  21. https://learn.microsoft.com/en-us/azure/cosmos-db/conflict-resolution-policies
  22. https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-manage-conflicts
  23. https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-configure-per-partition-automatic-failover
  24. https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/sdk-connection-modes