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
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: RPO = 0 seconds (continuous backup, 30-day retention)
- 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:
| Setting | Options | Default |
|---|---|---|
| Interval | 1-24 hours | 4 hours |
| Retention | 2Γ interval to 720 hours (30 days max) | 8 hours (2 copies) |
| Redundancy | Locally redundant, Zone-redundant, Geo-redundant | Geo-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:
| Feature | Continuous 7-day | Continuous 30-day |
|---|---|---|
| Retention | 7 days | 30 days |
| Restore granularity | Any second within window | Any second within window |
| Self-service restore | β Yes (portal, CLI, SDK) | β Yes |
| Cost | Included (no extra charge) | Additional charge per GB/month |
| Restore target | New account or existing account | New account or existing account |
| Multi-region writes | Supported | Supported |
| Migration from periodic | β Supported | β Supported |
# 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 --name finsecure-restored \
--resource-group rg-finsecure \
--target-database-account-name finsecure-transactions \
--restore-timestamp "2025-07-15T10:30:00Z" \
--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
- Throughput settings, indexing policies, and stored procedures are 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
| Aspect | Periodic Backup | Continuous Backup |
|---|---|---|
| RPO | Backup interval (1-24 hours) | ~0 seconds (any timestamp) |
| Self-service restore | β Contact Azure Support | β Self-service via portal/CLI |
| Granularity | Full snapshot at interval | Any second within retention |
| Retention | Up to 30 days | 7 or 30 days |
| Extra cost | None (included) | None for 7-day; extra for 30-day |
| Restore target | New account | New account or existing account |
| When to use | Cost-conscious, relaxed RPO | Mission-critical, near-zero RPO |
π¬ Video walkthrough
π¬ Video coming soon
Backup and Restore β DP-420 Module 23
Backup and Restore β DP-420 Module 23
~14 minFlashcards
Knowledge Check
Marcus's transaction database requires near-zero RPO and the ability to restore without contacting Azure Support. Which backup mode should he choose?
A developer accidentally deletes a container at 2:15 PM. The account uses continuous backup with 30-day retention. What's the restore process?
Next up: Network Security β firewalls, VNets, private endpoints, and CORS for securing access to your Cosmos DB account.