Other Articles

Cosmos DB – Enable Backup

This check ensures that backup is enabled for Azure Cosmos DB (DocumentDB) accounts to protect data against accidental deletion, corruption, or service failures. Enabling backup helps maintain data integrity and availability.

Check Details

  • Resource: Azure Cosmos DB (DocumentDB)
  • Check: Ensure Backup Is Enabled
  • Risk: If backups are not properly configured, data loss caused by accidental deletion, application errors, or malicious activity may become permanent, impacting business continuity and regulatory compliance.

Remediation via Azure Portal

  1. Log in to the Azure Portal. Azure Portal dashboard
  2. Navigate to Azure Cosmos DB and select the affected database account. Azure Cosmos DB accounts list
  3. In the left-hand menu, select Backup and Restore under Settings. Cosmos DB backup settings
  4. Verify that Backup policy is configured.
  5. Ensure one of the following is enabled:
    • Periodic backup with appropriate retention period.
    • Continuous backup (Point-in-Time Restore).
    Cosmos DB backup policy
  6. Click Save if changes are required.

Remediation via Azure CLI

  1. Open Azure Cloud Shell or a local terminal with Azure CLI installed. Azure Cloud Shell
  2. Check the current backup configuration:
    az cosmosdb show \
     --resource-group < resource-group> \
     --name < cosmos-account-name> \
     --query backupPolicy
    
  3. Enable periodic backup (if not already configured):
    az cosmosdb update \
     --resource-group < resource-group> \
     --name < cosmos-account-name> \
     --backup-policy-type Periodic
    
  4. Alternatively, enable continuous backup (Point-in-Time Restore):
    az cosmosdb update \
     --resource-group < resource-group> \
     --name < cosmos-account-name> \
     --backup-policy-type Continuous
    

Replace <resource-group> and <cosmos-account-name> with your actual values. The output should confirm that the backup policy type is set to either Periodic or Continuous.