Manvendra Singh
Backup storage redundancy updated for cosmos db account

Configure backup storage redundancy for Azure Cosmos DB account

May 15, 2024 by

This article will explain backup storage redundancy for Azure Cosmos DB. Backups are a critical feature to keep copies of our data to ensure data protection and recoverability in case of any accidental deletion, updating, or any kind of disaster. But this is not enough to run backups only to save its copies. We must also protect those backup copies from accidental deletes or corruption and ensure their proper resiliency should be in place to keep backups safe from any unforeseen circumstances. It depends on the criticality of your data whether you want to keep them locally to want to replicate them in other locations or regions to ensure their resiliencies.

Azure Cosmos DB accounts periodically run backups at defined intervals on geo-redundant Azure blob storage accounts. Data replicates to the respective paired region in geo-redundancy mode to protect backup copies from planned or unplanned events, system failure, or in case of any disaster situations. Cosmos DB supports 3 types of storage redundancy models to protect backup copies.

  • Geo-redundant backup storage
  • Zone redundant backup storage
  • Locally redundant backup storage

Geo-redundant backup storage is the default configuration for Cosmos DB backup storage redundancy. Backup copies replicate to the respective paired region which is physically separated hundreds of miles away in this redundancy model. Zone redundant backup storage replicates backup copies to the availability zones which is a separate physical location which is using separate networking, power, and cooling. Locally redundant backup storage keeps your backup copies in the same physical location which might be using the same power, cooling, and networking. You can check the paired location for your primary region in the attached MDSN link.

You must also be aware of the pricing impact while choosing any of these backup storage redundancies. Locally redundant backup storage is the cheapest option among all 3 whereas Geo-redundant backup storage is the costliest option available for your Cosmos DB account. You must use the Azure Cosmos DB pricing calculator to get the approximate cost you need to pay while choosing the desired redundancy model.

When we provision a new cosmos DB account, you have the option to choose your desired backup storage redundancy model in the periodic backup policy. Note, you can only configure the backup storage redundancy model in the Periodic backup policy, another backup policy continuous backup does not allow users to configure or modify this setting. You can verify or modify the backup storage redundancy model using the Backup Policy tab of the new account creation form. Have a look at the below image where the default configuration is set while provisioning an Azure Cosmos DB account. If you want to change backup storage redundancy from default configuration to zone or locally redundancy storage, then you can click on the respective radio button while provisioning your cosmos DB account.

Backup Policy tab while provisioning Azure Cosmos DB account

Next, I will explain how to update backup storage redundancy to a different one from the current configuration of an existing Azure Cosmos DB account.

Change backup storage redundancy of an Azure Cosmos DB account

I assume you already have a cosmos DB account that was provisioned with default backup storage redundancy i.e., Geo-redundant backup storage. Now, there is a requirement came to change it to Zone redundant backup storage. Let’s perform this exercise in the below steps.

Log in to the Azure portal. Go to the Azure Cosmos DB account dashboard page. Choose your desired cosmos DB account for which you want to change backup storage redundancy. Click on this cosmos DB account to open its Overview page. Now you can access its Backup & Restore tab given under Settings from the left side pane to access its periodic backup configurations options.

Let’s assume we have a cosmos DB account mdscosnosdb1 for which we need to update backup storage redundancy as Zone redundant backup storage. I have accessed the Backup & Restore tab from Settings given in the left side pane as shown in the below image. We can see it has a default configuration set as geo-redundant backup storage. You need to select the appropriate radio button from the Backup storage redundancy given in the right side pane of the below image, here we want to update it to zone redundancy so let’s click on the second option.

Backup & Restore tab of a cosmos db account

I have chosen Zone redundant backup storage for this cosmos DB account mdscosmosdb1 and hit the Submit button to apply the changes.

Change backup storage redundancy of cosmos db account

Once you hit the Submit button post selecting your desired configuration from the above image, you will get a below pop-up window stating “…Update backup policy” in the top right corner along with a notification message on the screen “Updating backup policy for this account”.

Apply the changes you made in backup storage redundancy for cosmos db account

You will keep on seeing the “Updating backup policy for this account” notification till the time updates will be successfully applied to this Azure Cosmos DB account. It will take time so you should wait and let Azure process this update successfully for this cosmos DB account.

Once an update will be successfully applied to this account then the previous notification message will change to another green notification message stating “Successfully updated backup policy for this account” as shown in the below image.

Backup storage redundancy updated for cosmos db account

There could be a scenario where your primary region might not have all three backup storage redundancies supported so you must check and ensure whether your To-be configuration is supported or not for your cosmos DB account. Let’s assume you have provisioned your cosmos DB account in UAE north region which does not support zone redundant backup storage so you cannot choose zone redundancy for cosmos DB accounts from this region.

The below Azure Cosmos DB account mdscosmosdb2 has been provisioned in UAE north region. When you access its Backup & Restore tab given under Settings from the left side pane then you will observe that there are only two backup storage redundancies showing for this account in the below image. Zone redundant backup storage is not showing which means this redundancy is not supported for this region and cannot be configured. You can either go with the existing configuration which is geo-redundant, or you can choose locally redundant backup storage for this cosmos DB account. Make sure to analyze the criticality of the backup copies which you want to place on locally redundant backup storage.

Check backup storage redundancy options for a cosmos db account provisioned in UAE north region

You can follow the same steps which we followed while modifying backup storage redundancy from geo-redundant to zone redundant in the above steps. You can choose the radio button for the locally redundant backup storage option and hit the submit button to apply this update to this Azure Cosmos DB account.

Change backup storage redundancies

You can see updates are being applied to the cosmos DB account in the same manner in the below image.

Apply modified value

Once backup storage redundancy will be updated, you will get its successful notification in green color as it is shown in the below image.

Backup storage redundancy updated for cosmos db account

We can also modify backup storage redundancy with the help of PowerShell cmdlets. You need to connect to an Azure account and then you must check the region supporting for backup redundancy options and based on the outcome you can choose appropriate backup storage redundancies. Make sure you are running on the latest version of the PowerShell module or version 1.4.0 or higher.

Next check the backup storage redundancy options supported to your primary region where Azure Cosmos DB account exists. Run below cmdlets, make sure to replace <RegionName> with your primary region name.

All supported redundancy options will be displayed while accessing the BackupStorageRedundancies property using the above command. Once you are sure that your to be desired redundancy options are supported in this region then you can run below PowerShell cmdlets to update the backup storage redundancy for your cosmos DB account using PowerShell cmdlets.

Conclusion

I have explained backup storage redundancy options available for the Azure Cosmos DB account. You must plan it and choose appropriate backup storage redundancy to ensure data protection and keep your backup copies safe from any unforeseen circumstances like natural or manmade disasters, accidental deletes, or other planned or unplanned events from system or region-specific.

Manvendra Singh
Azure Cosmos DB

About Manvendra Singh

Manvendra is a database enthusiast, currently working as a Senior Architect at one of the top MNC. He loves to talk and write about database technologies. He has lead and delivered many projects from designing to deployments on Migrations to the cloud, heterogeneous migrations, Database consolidations, upgrades, heterogeneous replication, HA / DR solutions, automation, and major performance tuning projects. You can also find him on LinkedIn View all posts by Manvendra Singh

168 Views