Managing Azure Table Storage: Delete Table Entities using Logic APPS
Published Sep 12 2019 10:46 PM 15.5K Views

Currently the challenge in Azure Table Storage, we do not have any out of the box support for life cycle management of table entities. However, we may use Azure Resources such as Function APP, Logic APP, WebJobs (or) even programmatically via PowerShell or Storage Rest API's, etc., to manage Table Storage data.

 

This article focuses on usage of Logic Apps to manage table entities such as deleting the table entity after a given number(x) of days of an existing storage account.

 

Title2.PNG

 

Step 1: Create a Logic Apps Resource Instance

 

  1. In a new browser window, sign in to the Azure Portal.
  1. Search for Logic Apps in search box (or) Click Create a resource > Integration > Logic Apps.Pic1.png
  2. Create a Logic App in your subscription by providing relevant details in the resource creation blade.Pic2.png
 

Step 2: Creation of Workflow

 

  1. Once the logic app resource is created, you can select View in Logic Apps Designer (or) View in Logic Apps Designer.Pic3.png
  2. Select Blank Logic App, and select Schedule template with recurrence as trigger, which means logic app will trigger based on the schedule time frequency.Pic4.pngPic5.pngPic6.png
  3. Set the interval and frequency for the recurrence. In this example, set these properties to run your workflow once every week. You may follow through the article for schedule connector.Pic7.png
  4. Select '+ New Step' and search for Azure Table Storage.Pic8.png
  5. To delete the entities which are older than the given number days, you need to first get the entities, so select Get entities action.Pic9.png
  1. You need to set the connection to get the entities of Storage Table. Provide the connection name and select the intended storage account, click on Create button. After this the Storage connection context should be created.Pic10.png
  2. Next select the Storage Table and add filter query as "Timestamp le datetime'fx addDays(utcNow(), -7)'".Pic11.pngPic12.pngPic13.png
  3. Select '+ New Step' and search for 'Control', then select 'For Each' action.Pic14.pngPic15.png
  4. For select an output from previous steps, you need to select 'Get entities result list of Entities'.Pic16.png
  5. Next select 'Add an action' and search for Azure Table Storage again and choose Delete Entity this time.Pic17.pngPic18.png
  6. Select the same table name again and choose the 'Get entities result An entity Partition Key' and 'Get entities result An entity Row Key'. Click Save button for saving the workflow.Pic19.pngPic20.png
 

 

Step 3: Execute the weekly recurrence workflow on-demand

 

  1. You can run this workflow on demand apart from schedule time. Once you hit run, you might see output like displayed below.Pic21.png
  2. You can very if the table entities were deleted from Storage explorer or Azure Portal. Below screenshot were from storage before and after execution of above Logic Apps workflow.Pic22a.pngPic22.png
  3. You can also check the history of Logic Apps workflow execution from the Azure Portal Logic App Instance blade.Pic23.png
 

Recommendations/Additional Information

 

Disclaimer:

Consider the pricing aspect and the billing for LogicApp to avoid the high cost. Refer the below articles:

LogicApp Pricing model : https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-pricing#fixed-pricing
LogicApp Pricing details and FAQ: https://azure.microsoft.com/en-us/pricing/details/logic-apps/
How billing and Pricing works for LogicApps: https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-pricing#triggers

 

 

Conclusion

I hope this article might have helped you to setup the deletion of table entities in Azure Storage Account using Logic Apps as one of the possible ways. Please do share if you have any questions/feedback in the comment section below and will try in replying to you at the earliest.

1 Comment
Version history
Last update:
‎Jan 20 2021 08:08 PM
Updated by: