Forum Discussion
Restore Azure Cosmos DB
Recently, I accidentally deleted an azure cosmos db database, how can be restored? It is possible to recover if it was more than 7 days ago?
3 Replies
- ElenaMiaTin Contributor
Hi aurora95
If continuous backup was enabled before the database was deleted, you may be able to restore it to a previous point in time. However, Azure Cosmos DB has retention limits based on your backup policy, so if the deletion occurred more than 7 days ago, recovery may no longer be possible unless you have another backup or export available.
Has anyone successfully restored a Cosmos DB database after this timeframe, or are there any alternative recovery options that Microsoft recommends in such cases?
It depends on the backup mode that was enabled before the database was deleted.
If the account was using continuous backup, you can use point-in-time restore, as long as the delete time is inside the configured retention window. The restore normally goes to a new account.
If the account was using periodic backup, it is more limited. In that case I would open an Azure support request quickly and give them the account name, database/container name, region, and approximate delete time. Recovery is only possible if Microsoft still has a usable backup inside the retention window.
So the first two checks are: backup mode and retention period. If it was deleted more than 7 days ago, the configured retention window is the deciding factor.
Docs:
https://learn.microsoft.com/azure/cosmos-db/continuous-backup-restore-introduction
https://learn.microsoft.com/azure/cosmos-db/restore-account-continuous-backup
https://learn.microsoft.com/azure/cosmos-db/periodic-backup-restore-introduction- LainRobertsonSilver Contributor
Hi aurora95,
It depends on which continuous back-up tier was chosen when the account was purchased/created.
I suspect if you cannot see it, then it was purchased under the 7-day offer, in which case no, you cannot recover it.
Here's the relevant documentation which you can use to double-check since we can't answer this for you:
- Continuous Backup with Point-in-Time Restore - Azure Cosmos DB | Microsoft Learn
- Restore an Account That Uses Continuous Backup Mode - Azure Cosmos DB | Microsoft Learn
Cheers,
Lain