Continuous backup with point in time restore now in preview

Govind Kanshi

The public preview of continuous backup and point-in-time restore capabilities for Azure Cosmos DB database accounts with Core (SQL) API or API for MongoDB was announced today at Microsoft Ignite. These powerful new capabilities make it easy to:

  • Restore an accidentally deleted accountdatabase, or container.  
  • Recover from accidental corruption by restoring data to any second in the last 30 days. 
  • Perform restore into any regions (in multi-region accounts). 

You can use Azure portal, PowerShellCLI commands or Azure resource manager templates to:

  • Enable continuous backup during new account creation (pro tip: once enabled, there is no need to configure retention)
  • Trigger time-consistent restores
  • Exercise the well-defined resource model 

In addition, you can use the portal, PowerShell, and CLI to:

  • Define who can restore at the subscription or account level using existing roles

Enabling Continuous Backup   

In Azure portal

Using the Azure portal, enable continuous backup during account creation by navigating to “Backup Policy”, as shown below.

Image of continuous backup enabled during account creation
Azure portal

Using Azure CLI (command line interface)

az cosmosdb create \
  --name pitracct2 \
  --resource-group myrg \
  --backup-policy-type Continuous \
  --locations regionName="West US"

Using Azure PowerShell

New-AzCosmosDBAccount `
  -ResourceGroupName "myrg" `
  -Location "West US" `
  -BackupPolicyType Continuous `
  -Name "pitracct2" `
  -ApiKind "Sql"

Restoring data to a point in time

In Azure portal

Restore requires a click on the point in time restore on the portal menu, choosing the date, utc timelocation and new account name.  

Deleted Data restore

 

Using Azure CLI

az cosmosdb restore \
 --target-database-account-name <restored-account-name> \
 --account-name <sourceDatabaseAccountName> \
 --restore-timestamp   <UTC time> \   
 --resource-group  <resourceGroupName> \
 --location <Azure Region Name>

Using Azure PowerShell

Restore-AzCosmosDBAccount `
  -TargetResourceGroupName <resourceGroupName> `
  -TargetDatabaseAccountName <restored-account-name> `
  -SourceDatabaseAccountName <sourceDatabaseAccountName> `
  -RestoreTimestampInUtc <UTC time> `
  -Location <Azure Region Name>

 

Restoring a deleted account

You can restore a deleted account by using the restore capability on the portal like below 

Restore Deleted Account

 

You can assign the CosmosRestoreOperator built-in role at the subscription or account level to restrict who can restore. The example below shows how to assign that capability at the subscription level:

az role assignment create --role "CosmosRestoreOperator" --assignee <email> –scope /subscriptions/<subscriptionId>

Getting started

New to Azure Cosmos DB?

1 comment

Discussion is closed. Login to edit/delete existing comments.

  • Rich Mercer 1

    Are there any plans to allow enabling this for existing databases? It’s going to be a pain to have to delete/recreate my DB. I would have to delete the DB before creating the new one to take advantage of the free 400RU’s as well as you only get this on one database.

Feedback usabilla icon