Backing Up Azure Table Storage: Enter The Logic App
Recently I’ve used Azure Table Storage to provide a data store for a couple of applications. It’s lightweight, easy to implement, and flexible in the case of changing or inconsistent data points. I soon ran across the question of how to easily back up the table, however. In my case, there would eventually be multiple hands changing and adding data, so making a daily copy was a necessity.
Searching the web brought no hard and fast results. It seems Azure, as of this writing, doesn’t provide an out of the box solution for this. They do however provide a connector within Azure Logic Apps that deals directly with Table Storage. They also provide an interface, which is quite slick, once you get the hang of it. In this post, we’ll take a look at how to back up a table to another table on a daily basis.
- Navigate to Logic Apps within Azure Portal and click Add. Give it a name, choose a subscription, resource group, and location, and click Create.
2. After deployment, either ‘Go To Resource’, or manually navigate to your newly created Logic App. Click ‘Logic app designer’ under Development Tools, and choose ‘Blank Logic App’ in the next blade.
3. We’re going to use the interface to construct its logic. Once per day, loop through all the rows in the table, and merge them into the backup table. First off, the recurrence. Click All, Schedule, Recurrence, enter 1 Day, and New Step.
4. This will bring you back around to choosing a connector or action. Search for Azure Table Storage, and click the connector. Choose Get Entities, and choose your Storage Account. Pick the table, and New Step.
5. Choose Control. These are bits of logic you can use within your, well, Logic App. Choose ‘For each’. Click in the ‘Select an output from previous steps’ box, and choose ‘Get entities result List of Entities’ from the popup. Then ‘Add an action’.
6. You can probably guess where we’re going here. Search for Azure Table Storage, choose Insert or Replace Entity in Azure Table Storage (you can also look into Insert or Insert or Merge if that suits your situtation). Then input your destination table’s information. Click into the boxes, the screenshot shows the correct responses to choose from the popup. Click Save at the upper left of the blade.
7. Click Run, and check your backup table. To test this, go back into the designer, change the recurrence to a minute, add some data to the table, and wait for the Logic App to trigger again. You should see your new data purring away in the backup table.
By the way, Azure Table Storage Explorer is a fantastic tool to help with this, if you haven’t already tasted the Kool-Aid. Well worth the price of free from Microsoft.
https://azure.microsoft.com/en-us/features/storage-explorer/
Thanks for reading, and happy backup-ing!