title | description | author | ms.service | ms.topic | ms.date | ms.author | ms.reviewer |
---|---|---|---|---|---|---|---|
Update backup storage redundancy for Azure Cosmos DB periodic backup accounts |
Learn how to update the backup storage redundancy using Azure CLI, and PowerShell. You can also configure an Azure policy on your accounts to enforce the required storage redundancy. |
kanshiG |
cosmos-db |
how-to |
12/03/2021 |
govindk |
mjbrown |
[!INCLUDEappliesto-all-apis]
By default, Azure Cosmos DB stores periodic mode backup data in geo-redundant blob storage that is replicated to a paired region. You can override the default backup storage redundancy. This article explains how to update the backup storage redundancy using Azure CLI and PowerShell. It also shows how to configure an Azure policy on your accounts to enforce the required storage redundancy.
Use the following steps to update backup storage redundancy from the Azure portal:
-
Sign into the Azure portal and navigate to your Azure Cosmos DB account.
-
Open the Backup & Restore pane, update the backup storage redundancy and select Submit. It takes few minutes for the operation to complete:
:::image type="content" source="./media/update-backup-storage-redundancy/update-backup-storage-redundancy-portal.png" alt-text="Update backup storage redundancy from the Azure portal":::
Use the following steps to update the backup storage redundancy on an existing account using Azure CLI:
-
Install the latest version if Azure CLI or a version higher than or equal to 2.30.0. If you have the "cosmosdb-preview" extension installed, make sure to remove it.
-
Use the following command to get the backup redundancy options available in the regions where your account exists:
az cosmosdb locations show --location <region_Name>
{ "id": "subscriptionId/<Subscription_ID>/providers/Microsoft.DocumentDB/locations/eastus/", "name": "East US", "properties": { "backupStorageRedundancies": [ "Geo", "Zone", "Local" ], "isResidencyRestricted": false, "supportsAvailabilityZone": true }, "type": "Microsoft.DocumentDB/locations" }
The previous command shows a list of backup redundancies available in the specific region. Supported values are displayed in the
backupStorageRedundancies
property. For example some regions such as "East US" support three redundancy options "Geo", "Zone", and "Local" whereas some regions like "UAE North" support only "Geo" and "Local" redundancy options. Before updating, choose the backup storage redundancy option that is supported in all the regions where your account exists. -
Run the following command with the chosen backup redundancy option to update the backup redundancy on an existing account:
az cosmosdb update -n <account_Name> -g <resource_Group> --backup-redundancy "Geo"
-
Run the following command to create a new account with the chosen backup redundancy option:
az cosmosdb create -n <account_Name> -g <resource_Group> --backup-redundancy "Geo" --locations regionName=westus
-
Install the latest version of Azure PowerShell or a version higher than or equal to 1.4.0
Install-Module -Name Az.CosmosDB -RequiredVersion 1.4.0
-
Use the following command to get the backup redundancy options available in the regions where your account exists:
$location = Get-AzCosmosDBLocation -Location <region_Name> $location.Properties.BackupStorageRedundancies
The previous command shows a list of backup redundancies available in the specific region. Supported values are displayed in the
backupStorageRedundancies
property. For example some regions such as "East US" support three redundancy options "Geo", "Zone", and "Local" whereas some regions like "UAE North" support only "Geo" and "Local" redundancy options. Before updating, choose the backup storage redundancy option that is supported in all the regions where your account exists. -
Run the following command with the chosen backup redundancy option to update the backup redundancy on an existing account:
Update-AzCosmosDBAccount ` -Name <account_Name> ` -ResourceGroupName <resource_Group> ` -BackupStorageRedundancy "Geo"
-
Run the following command to create a new account with the chosen backup redundancy option:
New-AzCosmosDBAccount ` -Name <account_Name> ` -ResourceGroupName <resource_Group> ` -Location <region_Name> ` -BackupPolicyType Periodic` -BackupStorageRedundancy "Geo"
Azure Policy helps you to enforce organizational standards and to assess compliance at-scale. The following sample shows how to add an Azure policy for the database accounts to have a backup redundancy of type "Zone".
"parameters": {},
"policyRule": {
"if": {
"allOf": [
{
"field": "Microsoft.DocumentDB/databaseAccounts/backupPolicy.periodicModeProperties.backupStorageRedundancy",
"match": "Zone"
}
]
},
"then": {
"effect": "audit"
}
}
- Provision an Azure Cosmos DB account with [periodic backup mode'(configure-periodic-backup-restore.md).
- Provision an account with continuous backup using Azure portal, PowerShell, CLI, or Azure Resource Manager.
- Restore continuous backup account using Azure portal, PowerShell, CLI, or Azure Resource Manager.