This is a sample application that uses Azure Functions for backing up Azure Cosmos DB databases and collections to a blob storage container in an Azure Storage account.
The application is build on v2 of the Azure Functions runtime. It uses a timer triggered function that starts an orchestration built using the Durable Functions extension.
The orchestration function then takes care of reading all documents in the configured Cosmos DB database, and storing them in the configured storage account.
Note that Azure Cosmos DB automatically backs up all your data, and keeps the backups available in case you need to restore. However, to restore a Cosmos DB database from backup, you must file a support ticket or call Azure support to ask them have the data restored.
To be able to better control how my backups are done, and how I restore data in case I need to, I wrote this application and thought you might want to use it too, or fork it to modify it to better suit your needs.
If you think there's something missing or want to add functionality, please consider sending me a pull request with your improvements.
Read details about how to configure the application before deploying and running it.
This application does NOT take a snapshot of the configured database, so the contents of the database may change while the database is being backed up. Therefore, the backup is not guaranteed to be in a consistent state when completed.
However, since there are no mechanisms for enforcing referential integrity, this is not that big of a problem as it would be for instance with a relational database like SQL Database.