How Do I Backup Azure Tables and Blobs

Keith Holloway picture Keith Holloway · Mar 7, 2016 · Viewed 11.2k times · Source

I store data in Azure Storage tables and blob storage. I would like to automatically backup my data to protect against accidental data corruption by users or by a software issue. There isn't a good solution for this from Microsoft and, while there are paid solutions for automatic backups, it seems like there should be a straight-forward way to backup and restore this data.

Answer

Keith Holloway picture Keith Holloway · Mar 7, 2016

After doing a lot of research on the best way to automatically backup data, I found that the easiest way to do this is to schedule a job in the Windows Task Scheduler on an Azure virtual machine that uses AZCopy. AZCopy does the work of moving the table data to the VM and then back out to a secondary blob store in Azure to hold the backup. The batch file also causes AZCopy to copy the blobs from the source storage account into the target account directly.

You can see a detailed description of how I made this work complete with links to the batch files that I use to automate the backup at this link: http://www.eastfive.com/2016/03/01/automated-backup-of-azure-storage-tables-and-blobs/

02/08/2018 update on this answer: I raised this question to Azure support on January 18, 2018, assuming that surely they had a way to do this now via a service in Azure. Unfortunately that is not the case and there is (according to Microsoft support) no better way to do table backups than those that existed when this question was first posed. This is the answer from support from 01/24/2018:

"I have reviewed over your case and unfortunately there is not a way to do a snapshot of an entire account or container and so the only way to do snapshots with Azure Storage is through blob iteration and applying snapshots then migrating the snaps over to a secondary account. Or you can simply copy the actual files to another account but this would have higher latency and be more costly on storage capacity, where snapshots would take up less and be quicker to transfer.
The methods we support for transfer are AzCopy and the Data Movement Library which can be used to make custom migration solutions in Java or C#.
If you wanted to automate these processes then you could do this via Powershell and Azure Automation or with Azure Functions but assistance with those solutions would likely need to be raised through another support request as my team purely supports Azure Storage."

So, there still exists no automated way to do these backups. My team is working on a library to do backups. When we have that completed, I will post back here.

05/08/2018 update on this answer: As mentioned, my team has been working on a library to automate backups. You can find the project here: https://github.com/eastfivellc/EastFive.Azure.Storage.Backup. Please feel free to contribute.

10/18/2018 update on this answer: I was able to copy data in Azure using their Azure Data Factory functionality. I used Data Factory to pipe data from my source to target storage for both tables and blobs. However, the data movement costs are exorbitantly high (in the hundreds of dollars per backup). So, this is not a solution for backups. As mentioned in my post from above (and in an answer below), the Azure Data Movement Library is the best solution here.