Restore a deleted container or database to the same Azure Cosmos DB account

APPLIES TO: NoSQL MongoDB Gremlin Table

The Azure Cosmos DB point-in-time same-account restore feature helps you recover from an accidental deletion of a container or database. This feature restores the deleted database or container to the same, existing account in any region in which backups exist. Continuous backup mode allows you to restore to any point of time within the last 30 days.

Prerequisites

  • An Azure subscription. If you don't have an Azure subscription, create a free Azure account before you begin.
  • An Azure Cosmos DB account. You can choose one of the following options for an Azure Cosmos DB account:

Restore a deleted container or database

Use the Azure portal, the Azure CLI, Azure PowerShell, or an Azure Resource Manager template to restore a deleted container or database in the same, existing account.

Use the Azure portal to restore a deleted container or database. Child containers are also restored.

  1. Go to the Azure portal.

  2. Go to your Azure Cosmos DB account, and then go to the Point In Time Restore page.

    Note

    The restore page in Azure portal is populated only if you have the Microsoft.DocumentDB/locations/restorableDatabaseAccounts/*/read permission. To learn more about this permission, see Backup and restore permissions.

  3. Select the Restore to same account tab.

    Screenshot of the options to restore a database or container to the same account.

  4. For Database, enter a search query to filter the event feed for relevant deletion events for a container or a database.

    Screenshot of the event filter showing deletion events for containers and databases.

  5. Next, specify Start and End values to create a time window to use to filter deletion events.

    Screenshot of the start and end date filters further filtering down deletion events.

    Note

    The Start filter is limited to at most 30 days before the present date.

  6. Select Refresh to update the list of events for different resource types with your filters applied.

  7. Verify the time, and then select Restore to start restoration of the selected resource that was previously deleted.

    Screenshot of the confirmation dialog prior to a restore operation.

    Important

    No more than three restore operations can be active at any time on the same account. Deleting the source account while a restore operation is in progress might result in the failure of the restore operation.

    Note

    The event feed displays resources as Not restorable. The feed provides more information about why the resource can't be restored. In most cases, you must restore the parent database before you can restore any of the database's child containers.

  8. After you initiate a restore operation, track the operation by using the notifications area of the Azure portal. The notification provides the status of the resource that's being restored. While restore is in progress, the status of the container is Creating. After the restore operation completes, the status changes to Online.

Track the status of a restore operation

When a point-in-time restore is initiated for a deleted container or database, the operation is identified as an InAccount restore operation on the resource.

To get a list of restore operations for a specific resource, filter the activity log of the account by using the InAccount Restore Deleted search filter and a time filter. The list that's returns includes the UserPrincipalName field, which identifies the user who initiated the restore operation. For more information about how to access activity logs, see Audit point-in-time restore actions.

Next steps