Azure Cosmos DB provides automatic backups to help recover data after accidental deletion, unwanted updates, or service failures. However, traditional backup and restore capabilities may not be enough for applications that handle financial records, customer information, business transactions, or other critical data.
Consider a situation where an attacker gains access to an administrator account and deletes production data. If the attacker can also delete the backups, the organization may lose both its live data and its recovery options. This is one reason why immutable backups are an important part of a modern data protection strategy.
Azure provides two complementary approaches for protecting Azure Cosmos DB data. The native Cosmos DB backup service provides operational recovery, including point-in-time restore. Azure Backup for Cosmos DB adds vaulted backups, long-term retention, and Write Once, Read Many (WORM) immutability.
Understanding the difference between these services is important when designing a secure backup strategy. This article explains how they work, how to configure immutable backups, how restoration works, and what developers and cloud administrators should consider in production environments.
Understanding Immutable Backups
An immutable backup is a backup copy that cannot be modified or deleted during its protected retention period. Once the backup is stored, the system prevents unauthorized changes to the recovery data.
This protection is especially useful against ransomware and compromised administrator accounts. An attacker might be able to modify or delete production records, but should not be able to destroy the protected backup copies needed to recover the application.
Immutable backup protection generally uses the WORM model:
Write Once: Backup data is written into protected storage.
Read Many: Authorized users and recovery services can read the stored backup data.
No unauthorized modification: Existing recovery points cannot be changed.
No premature deletion: Protected recovery points cannot be deleted before their retention period expires.
Immutability is different from simply keeping multiple copies of a database. Multiple copies can still be deleted if they share the same administrative permissions. Immutable storage introduces additional restrictions that protect the recovery data itself.
For Azure Cosmos DB, it is important to understand where this protection is applied. The native backup service already manages backups in a way that prevents customers from directly modifying or deleting the stored backup copies. Azure Backup adds a separate vaulted backup layer with explicit WORM immutability controls.
Understanding Azure Cosmos DB Backup Options
Azure Cosmos DB supports two native backup modes: periodic backup and continuous backup. Azure Backup for Cosmos DB adds another layer for long-term protection.
Periodic Backup
Periodic backup is the traditional backup mode in Azure Cosmos DB. The service automatically creates full backups at configured intervals and stores them separately from the live database.
The default configuration generally creates a backup every four hours and retains the two most recent backups. Administrators can configure the backup interval and retention period at the account level.
Periodic backup is useful for applications that need basic protection against accidental data deletion or modification. However, it does not provide the same self-service point-in-time recovery experience as continuous backup. Restoration normally requires submitting a request through Azure Support.
Continuous Backup
Continuous backup provides point-in-time restore (PITR). Instead of relying only on periodic snapshots, it maintains recovery information that allows the database to be restored to a selected point within the configured retention period.
Azure Cosmos DB provides continuous backup retention tiers, including 7-day, 30-day, and 35-day options, depending on the account configuration and supported capabilities.
This mode is useful when an application needs to recover from an accidental update or deletion that happened recently. For example, if a developer executes an incorrect update query, the database can be restored to a point before that operation.
Continuous backup also supports self-service restore through supported Azure management interfaces.
Azure Backup for Cosmos DB
Azure Backup for Cosmos DB provides a separate backup layer called vaulted backup. It stores protected recovery points in an Azure Backup vault rather than relying only on the native Cosmos DB backup storage.
The vaulted backup capability is designed for long-term retention, compliance, and ransomware recovery. It supports retention periods of up to 10 years, depending on the configured policy.
Its security features include:
WORM-based immutable backup storage.
Soft delete for additional deletion protection.
Azure role-based access control.
Multi-user authorization for sensitive operations.
Encryption using Microsoft-managed or customer-managed keys where supported.
Backup storage isolation from the source Cosmos DB account.
Azure Backup for Cosmos DB works alongside native continuous backup. It does not replace the native backup system.
The following table summarizes the differences.
Feature | Periodic Backup | Continuous Backup | Azure Backup Vaulted Backup |
|---|
Main purpose | Basic operational recovery | Point-in-time recovery | Long-term and cyber-resilient recovery |
Backup type | Periodic full backups | Continuous recovery information | Weekly full and daily incremental backups |
Recovery method | Azure Support request | Self-service PITR | Restore from Backup vault |
Retention | Configurable, up to one month | 7, 30, or 35-day tiers | Up to 10 years |
WORM immutability | Platform-managed backup protection | Platform-managed backup protection | Explicit immutable vault support |
Long-term compliance | Limited | Limited | Suitable for long-term retention |
Storage isolation | Platform-managed | Platform-managed | Separate Azure Backup vault |
For production applications, native continuous backup and vaulted backup serve different purposes. Continuous backup handles recent operational recovery, while vaulted backup provides an additional recovery option if the source environment or its administrative access is compromised.
How Azure Backup for Cosmos DB Works
Azure Backup integrates with Azure Cosmos DB and transfers scheduled backup data into a Backup vault.
The process involves several components:
Azure Cosmos DB: The source database account containing application data.
Backup vault: The destination that stores protected recovery points.
Backup policy: Defines backup schedules and retention rules.
Azure Backup service: Coordinates backup operations and manages recovery points.
Immutable storage: Protects backup data from unauthorized modification or deletion.
A typical backup policy uses one full backup every week and incremental backups on the remaining days.
A full backup creates a complete recovery baseline. Incremental backups capture only the changes since the previous backup. When an incremental recovery point is restored, Azure Backup uses the required full backup and incremental backup chain.
This approach provides a one-day recovery point objective (RPO) under the supported schedule.
For example, consider an application that stores customer transactions. If a database issue occurs on Thursday, the organization can select an available recovery point from the vaulted backup chain instead of depending only on the production database.
The backup vault also provides administrative and storage isolation. This means that compromising the source Cosmos DB account does not automatically provide direct access to delete the vaulted recovery points.
Prerequisites for Configuring Immutable Backups
Before enabling vaulted backup, review the supported account types and configuration requirements.
The current Azure Backup integration supports:
Azure Cosmos DB for NoSQL accounts.
Azure Cosmos DB for MongoDB accounts that use request units (RUs).
Accounts configured with continuous backup and point-in-time restore.
Azure Backup vaults configured with geo-redundant storage for the supported integration.
Restore operations to an empty, single-region target account using the same API type as the source account.
The integration is available in Azure public cloud regions. National and sovereign cloud environments have different availability and should be checked separately.
Some configurations are not supported. For example, accounts associated with a Network Security Perimeter and accounts using Per-Partition Automatic Failover have documented limitations.
You should also verify that the Cosmos DB account's primary write region matches the Backup vault region when configuring protection.
Before implementing the feature, review the current Azure Cosmos DB vaulted backup support matrix. Azure updates supported account sizes, regions, and recovery capabilities over time.
Configuring Immutable Backups Using the Azure Portal
The Azure portal provides a guided process for configuring vaulted backup.
Create or Select a Backup Vault
Start by creating an Azure Backup vault or selecting an existing vault.
Open the Azure portal.
Search for Backup vaults.
Select Create or open an existing Backup vault.
Choose the subscription and resource group.
Select the appropriate region.
Configure the supported storage redundancy option.
Complete the vault creation process.
For the Cosmos DB integration, the Backup vault must use geo-redundant storage according to the current support requirements.
The vault should be managed separately from the production database environment wherever possible. Using separate administrative roles and carefully controlled permissions reduces the risk of one compromised identity affecting both production and recovery data.
Create a Backup Policy
A backup policy defines how frequently backups are created and how long recovery points are retained.
Open the Backup vault and navigate to the protection policy section. Create a new policy for Azure Cosmos DB.
Configure the backup schedule and retention rules.
A typical policy includes:
Policy Setting | Example Configuration |
|---|
Full backup | Once per week |
Incremental backup | Daily on remaining days |
Recovery point objective | 1 day |
Weekly retention | Based on operational requirements |
Monthly retention | Several months or years |
Yearly retention | Up to the required compliance period |
The policy must contain a weekly full backup. Incremental-only policies are not supported.
Retention rules should reflect business and regulatory requirements. For example, an application may retain weekly recovery points for a shorter period and selected monthly or yearly recovery points for several years.
Do not configure a long retention period without considering the storage cost and recovery requirements.
Configure Protection for the Cosmos DB Account
After creating the vault and backup policy, connect the Cosmos DB account to Azure Backup.
Open the Azure portal and navigate to Resiliency.
Select Overview and then Configure protection.
Choose Azure as the resource management option.
Select Azure Cosmos DB as the data source type.
Choose Azure Backup as the protection solution.
Select the Backup vault.
Select the backup policy.
Choose the Cosmos DB account that needs protection.
Review the required role assignments.
Select Configure backup.
Azure Backup validates whether it has the required permissions to access the source Cosmos DB account.
The Backup vault needs the appropriate role assignment for long-term retention backup operations. If permissions are missing, the portal can provide an option to assign the required roles or download a role assignment template for an administrator.
Once validation succeeds, the protected item is created and scheduled backups can begin.
Enabling WORM Immutability in the Backup Vault
Configuring a backup policy does not automatically mean that the vault is locked against every destructive administrative operation. You must also review the vault's immutability configuration.
Azure Backup provides immutable vault protection with two important states.
Enabled State
In the Enabled state, immutability protection is active, but authorized administrators can still disable the setting when operational changes are required.
This state is useful during the initial setup of a backup environment. Administrators can validate backup policies, retention requirements, and recovery procedures before applying irreversible protection.
Locked State
The Locked state makes immutability irreversible.
After the vault is locked, protected backup data cannot be deleted before its retention period expires. Retention periods cannot be reduced in a way that destroys protected recovery points.
This provides stronger protection against compromised credentials, insider threats, and ransomware attacks.
However, locking a vault is a serious administrative decision. Review all protected items, backup policies, and retention rules before proceeding.
A practical implementation approach is:
Configure the backup vault and protection policy.
Enable immutability.
Run backup jobs and verify that recovery points are created.
Test restoration in a separate environment.
Review retention and compliance requirements.
Enable multi-user authorization for sensitive administrative operations.
Lock immutability after the security and operational review is complete.
The exact portal options can vary with the Backup vault configuration and current Azure service capabilities.
For regulated applications, the locked state is generally more appropriate when the organization requires WORM-based protection. Keep in mind that an irreversible lock can also prevent legitimate administrative changes.
Understanding Backup Security Controls
Immutable storage is only one part of a secure backup architecture. A production environment should combine several security controls.
Role-Based Access Control
Azure RBAC controls who can configure backup policies, manage vault resources, and perform restore operations.
Avoid giving every database administrator permission to manage backup vaults. Separate the responsibilities of application development, database administration, and backup administration.
For example, developers may need access to application data but should not automatically receive permission to delete protected recovery points.
Use the principle of least privilege and review role assignments regularly.
Multi-User Authorization
Multi-user authorization (MUA) introduces an additional approval requirement for selected critical backup operations.
This helps protect against situations where a single compromised administrator account attempts to make destructive changes.
For example, an administrator attempting to disable a security control may need approval from another authorized person.
MUA is particularly useful for production environments where backup configuration changes can affect regulatory compliance or business continuity.
Soft Delete
Soft delete protects backup data against accidental or malicious deletion.
When a protected recovery point is deleted, the service can retain it for a configured period rather than removing it immediately.
Soft delete and immutable storage provide complementary protection. Soft delete offers a recovery window, while locked immutability provides stronger restrictions against premature deletion.
Encryption
Backup data must remain protected while stored and transferred.
Azure Cosmos DB native backups use encryption with Microsoft-managed service keys. Customer-managed key protection is also available for supported native backup configurations.
Azure Backup provides encryption at rest and in transit, with Microsoft-managed or customer-managed keys where supported.
If an organization uses customer-managed keys, the key lifecycle becomes an important part of its recovery strategy. Key access, rotation, expiration, and deletion policies must be managed carefully. Losing access to a required encryption key can create recovery problems even when backup data is still available.
Restoring Data From Immutable Backups
A backup is useful only when the organization can restore it successfully.
Azure Backup for Cosmos DB supports restoration from a selected recovery point into a target Cosmos DB account. The target account must satisfy the supported restore requirements, including being empty, single-region, and using the same API type as the source account.
The general restore process is:
Open the Azure Backup vault.
Navigate to the protected Azure Cosmos DB account.
Open the available recovery points.
Select the required recovery point.
Choose the restore operation.
Specify the target Cosmos DB account.
Review the restore configuration.
Start the restore operation.
Verify the restored data and application behavior.
The restore process uses the selected recovery point and its required backup chain.
For example, suppose a customer management application experiences data corruption on Friday. The backup administrator can identify a recovery point from before the corruption and restore the data into a separate Cosmos DB account.
The application team can then validate the restored records before directing application traffic to the recovered environment.
Important Restore Limitations
Azure Backup for Cosmos DB has several limitations that should be considered when designing the recovery process.
Individual database and container restoration is not supported through the vaulted backup integration. The restore operation works at the account level.
The target account must be empty and use the same API type as the source.
The target account must be a supported single-region account.
Restoring an incremental recovery point requires its parent full backup and the intervening incremental backups.
Empty databases are not recovered during restoration.
Cross-subscription restore is supported.
Cross-region restore is supported to the Azure paired region under the documented conditions.
Accounts with certain network security and failover configurations are not supported.
Do not assume that restoring a backup automatically restores all networking, firewall, private endpoint, or application configuration. These settings should be managed separately as infrastructure configuration.
Native Point-in-Time Restore and Vaulted Restore
Although both approaches help recover data, they solve different problems.
Native point-in-time restore is designed for operational recovery. It allows an administrator to select a time within the continuous backup retention window and restore the account to that point.
Vaulted restore is designed for longer-term protection. It provides recovery points stored separately in Azure Backup, with retention and security controls designed for compliance and cyber recovery.
Consider the following scenarios.
Scenario | Recommended Recovery Approach |
|---|
A developer accidentally deletes records | Native point-in-time restore |
An application writes incorrect data | Native point-in-time restore |
Data must be retained for several years | Azure Backup vaulted backup |
A compromised administrator attempts to delete backups | Immutable vaulted backup |
The organization needs isolated recovery data | Azure Backup vault |
A recent database issue requires fast operational recovery | Native continuous backup |
A strong production strategy can use both services. Native continuous backup provides recent recovery points, while Azure Backup protects longer-term recovery data.
Monitoring Backup Operations
Backup monitoring is an important part of database operations. A backup policy may look correct in the portal, but that does not guarantee that every scheduled backup completed successfully.
Administrators should regularly review:
Backup job status.
Failed and incomplete backup operations.
Recovery point availability.
Retention policy compliance.
Vault storage consumption.
Role assignment changes.
Immutability and MUA configuration.
Restore job status and duration.
Azure Backup provides backup job monitoring and reporting through the portal. Scheduled backup failures caused by supported transient errors can also be handled through automatic retry mechanisms.
For production systems, configure operational alerts for backup failures and unexpected changes to protection settings. Backup administrators should investigate failed jobs rather than assuming the next scheduled backup will always succeed.
Cost Considerations
Azure Backup for Cosmos DB introduces additional costs beyond the native backup capabilities.
The main cost areas include:
Protected Instance fee: A management fee based on the protected account's data size.
Backup storage: Charges based on the amount of data retained in the Backup vault.
Restore operations: Charges based on the volume of data restored.
Longer retention periods increase the amount of backup storage required. Incremental backups can reduce storage consumption because they capture changes rather than creating a complete copy every day.
Before selecting a retention policy, estimate the database size, daily data changes, number of protected accounts, and required retention period.
For example, retaining recovery points for ten years may be necessary for certain compliance requirements, but it may be unnecessary for a temporary development environment.
The backup design should balance recovery requirements, compliance obligations, and storage costs.
Common Mistakes to Avoid
Relying Only on Native Backups for Long-Term Retention
Native backups are designed primarily for operational recovery. Their retention window is limited compared with vaulted backups.
If an application requires several years of retention or stronger isolation from production, evaluate Azure Backup for Cosmos DB.
Assuming Every Backup Is Explicitly WORM-Protected
Native Cosmos DB backups are platform-managed and protected against direct customer modification or deletion. However, this is not the same as configuring an Azure Backup vault with an explicit locked WORM immutability policy.
Understand which protection layer is enabled and what administrative controls apply to it.
Locking Immutability Before Reviewing Retention
Once immutability is locked, changing retention settings can become difficult or impossible when the change would weaken protection.
Review the backup schedule, retention rules, compliance requirements, and recovery process before locking the vault.
Ignoring Restore Testing
A successful backup job does not prove that the application can recover successfully.
Restore testing should be part of the regular operational process. Verify database records, indexes, application connections, permissions, and network configuration after restoration.
Giving Excessive Permissions to Administrators
Giving application developers and database administrators unrestricted access to the backup vault increases the risk of accidental or malicious changes.
Separate production database access from backup administration and use MUA for critical operations.
Forgetting Infrastructure Configuration
Restoring database data does not automatically recreate every application dependency.
Maintain separate infrastructure definitions for networking, firewall rules, private endpoints, application identities, and connection settings.
Best Practices for Production Applications
A reliable backup architecture should be designed around the application's recovery requirements rather than simply enabling every available backup feature.
Enable continuous backup for applications that need point-in-time recovery.
Use Azure Backup vaulted backups when long-term retention and isolated recovery are required.
Enable WORM immutability and lock the vault after reviewing all policies and recovery requirements.
Configure MUA for sensitive backup administration and security changes.
Separate backup administration from production database administration.
Use the principle of least privilege for Azure RBAC assignments.
Review encryption and customer-managed key lifecycle requirements.
Monitor scheduled backup jobs and investigate failures.
Test restoration regularly in an isolated environment.
Document RPO, RTO, recovery ownership, and escalation procedures.
Maintain infrastructure configuration separately from database backup data.
Review backup storage costs and retention requirements periodically.
RPO and RTO should be defined before selecting a backup policy.
RPO describes how much data the organization can afford to lose. RTO describes how long the application can remain unavailable while recovery is completed.
For example, a payment application may require a very small RPO and a short RTO, while an internal reporting system may tolerate a longer recovery window.
The backup architecture should reflect these differences.
Advantages and Disadvantages of Immutable Backups
Advantages
Protects recovery data against unauthorized modification and deletion.
Reduces the impact of ransomware and compromised administrator accounts.
Supports long-term data retention requirements.
Provides isolation between production data and vaulted recovery points.
Offers centralized backup management through Azure Backup.
Supports additional security controls such as MUA, RBAC, and soft delete.
Provides cross-subscription and supported cross-region recovery options.
Disadvantages
Introduces additional backup storage and management costs.
Requires careful planning before locking immutability.
Adds another service and configuration layer to manage.
Has account-type and configuration limitations.
Restore operations require a supported target account.
Does not automatically restore every application and networking configuration.
Requires regular testing to confirm that recovery procedures work as expected.
Conclusion
Protecting Azure Cosmos DB data requires more than enabling automatic backups. Production applications need a recovery strategy that considers accidental deletion, application errors, compromised credentials, ransomware, and long-term retention requirements.
Native periodic and continuous backups provide important operational recovery capabilities. Azure Backup for Cosmos DB adds a separate vaulted backup layer with long-term retention, WORM immutability, soft delete, RBAC, and multi-user authorization.
For applications that store critical business data, combining native continuous backup with immutable vaulted backups provides a stronger recovery architecture. Administrators should also test restoration, monitor backup jobs, separate administrative permissions, and document recovery objectives.
The most important point is that backup creation and backup protection are two different responsibilities. A reliable system must not only create recovery points but also ensure that those recovery points remain available when production systems or administrative accounts are compromised.
Join the conversation! Your thoughts help the community grow.