Domain 2 β€” Module 7 of 11 64%
22 of 31 overall
Domain 2: Secure, optimize, and deploy database solutions Free ⏱ ~14 min read

Backup and Restore: Periodic vs Continuous

Choose between periodic and continuous backup for Cosmos DB, configure backup policies, understand point-in-time restore, and know the cost and operational implications of each.

Backup: your safety net

Simple explanation

Think of backups like snapshots of your entire filing cabinet. Periodic backup takes a photo every few hours β€” if something goes wrong, you can restore from the last photo, but you lose changes since then. Continuous backup records every change as it happens β€” you can rewind to any second.

Marcus’s backup strategy

βš™οΈ Marcus at FinSecure handles financial data with strict RPO (Recovery Point Objective) requirements:

  • Transaction database: Continuous backup with a 30-day recovery window; verify the latest restorable timestamp against the required RPO
  • Analytics database: RPO = 4 hours (periodic backup, cost-effective)
  • Compliance requirement: All restores must be to a new account for audit isolation

Periodic backup

The default backup mode. Cosmos DB takes full snapshots automatically:

SettingOptionsDefault
Interval1-24 hours4 hours
Retention2Γ— interval to 720 hours (30 days max)8 hours (2 copies)
RedundancyLocally redundant, Zone-redundant, Geo-redundantGeo-redundant
# Configure periodic backup
az cosmosdb update --name finsecure-cosmos \
  --resource-group rg-finsecure \
  --backup-interval 60 \
  --backup-retention 168 \
  --backup-redundancy "Geo"

Key limitations:

  • Cannot self-restore β€” you must contact Azure Support for periodic backup restore
  • RPO = backup interval (if interval is 4 hours, you can lose up to 4 hours of data)
  • Backups are stored separately and don’t consume your account storage

Continuous backup

Continuous backup enables point-in-time restore (PITR) β€” restore to any second:

FeatureContinuous 7-dayContinuous 30-dayContinuous 35-day
Retention7 days30 days35 days
Restore granularityTimestamp within available backupTimestamp within available backupTimestamp within available backup
Self-service restoreYesYesYes
Backup storage chargeNo additional storage chargeAdditional chargeAdditional charge
Restore chargeChargedChargedCharged
Restore targetNew account; eligible deleted resources into existing accountNew account; eligible deleted resources into existing accountNew account; eligible deleted resources into existing account
# Enable continuous backup (30-day) on a new account
az cosmosdb create --name finsecure-transactions \
  --resource-group rg-finsecure \
  --backup-policy-type Continuous \
  --continuous-tier Continuous30Days

# Point-in-time restore
az cosmosdb restore --account-name finsecure-transactions \
  --resource-group rg-finsecure \
  --target-database-account-name finsecure-restored \
  --restore-timestamp "<timestamp-within-the-available-backup-window>" \
  --location "eastus"
Exam tip: restore options for continuous backup

Continuous backup supports restoring to a new account or to an existing account (for restoring deleted containers/databases). Periodic backup restore always creates a new account and requires contacting Azure Support. Key details:

  • Restoring to an existing account is preferred for deleted containers/databases (avoids data transfer cost)
  • Restoring to a new account is preferred for accidental data modification scenarios
  • The original account remains untouched when restoring to a new account
  • Data and index properties are restored; throughput settings might not match the restore point
  • Reapply firewall, private endpoint and RBAC settings; stored procedures, triggers and UDFs are not restored
  • The restored account gets a new name that you specify (for new account restores)

The exam may test this distinction β€” know that continuous backup now has both options, while periodic always needs a support ticket and new account.

Periodic vs continuous comparison

AspectPeriodic BackupContinuous Backup
RPODepends on the available snapshotCheck latest restorable timestamp; backups are asynchronous
Self-service restore❌ Contact Azure Supportβœ… Self-service via portal/CLI
GranularityFull snapshot at intervalAny second within retention
RetentionUp to 30 days7, 30 or 35 days
Extra costDepends on retained backup copiesStorage charge for 30/35-day; restores charged for all tiers
Restore targetNew accountNew account or existing account
When to useSnapshot-level recovery is sufficientFine-grained recovery from deletion or corruption

🎬 Video walkthrough

Flashcards

Question

What is the key difference between periodic and continuous backup?

Click or press Enter to reveal answer

Question

Where does a Cosmos DB restore go?

Click or press Enter to reveal answer

Question

Can you self-service restore from a periodic backup?

Click or press Enter to reveal answer

Question

How do continuous-backup storage and restore charges differ?

Click or press Enter to reveal answer

Knowledge Check

Knowledge Check

Marcus needs fine-grained timestamp recovery within 30 days and self-service restore. Which listed backup mode meets those requirements?

Knowledge Check

A developer accidentally deletes a container at 2:15 PM. The account uses continuous backup with 30-day retention. What's the restore process?


Official references

Next up: Network Security β€” firewalls, VNets, private endpoints, and CORS for securing access to your Cosmos DB account.