Set The Auto Delete For Old Azure Blobs Based On The Last Modified Time Using Azure Logic App

Azure Logic Apps

Logic App is a cloud-based service that allows us to react to an event in one service (such as SharePoint online) and do something with the data from that event into another service (such as Twitter). It makes it practical and simple for business processes. The users build workflows that automatically perform some business tasks and processes across applications and services. We can connect our business-critical apps and services with Azure Logic Apps, automating our workflows without writing a single line of code.

Before reading this article, please go through some important article links mentioned below,

Prerequisites

  • Microsoft Azure Account

Follow the below steps to build a Workflow using a template.

Step 1

  • Log into https://portal.azure.com/.
  • In the dashboard, choose to create a resource and click on Integration. Now, select "Logic App".

Set The Auto Delete For Old Azure Blobs Based On The Last Modified Time Using Azure Logic App

Step 2

Enter the name you want to assign to the logic. Select the subscription and resource group where you organize the related resources and location where your logic app is stored. Then, click on "Create".

Set The Auto Delete For Old Azure Blobs Based On The Last Modified Time Using Azure Logic App

Here is the dashboard. Click "Logic App Designer".

Set The Auto Delete For Old Azure Blobs Based On The Last Modified Time Using Azure Logic App

Step 3 - Choosing the template

Now, choose the template "Auto tier Azure blobs based on the last modified time".

Click on “use this template”

Set The Auto Delete For Old Azure Blobs Based On The Last Modified Time Using Azure Logic App

Step 4 - Mapping the storage account

Sign into Azure Blob Storage

Set The Auto Delete For Old Azure Blobs Based On The Last Modified Time Using Azure Logic App

Mapping your storage account with storage name and Access Key. Then click on Create

Set The Auto Delete For Old Azure Blobs Based On The Last Modified Time Using Azure Logic App

Click on Create

Set The Auto Delete For Old Azure Blobs Based On The Last Modified Time Using Azure Logic App

Step 5 - Configure the Recurrence.

Choose the interval (Here, you can change according to your needs), Frequency, Time Zone and Start time.

Set The Auto Delete For Old Azure Blobs Based On The Last Modified Time Using Azure Logic App

Here, we are choosing 1 as interval and Minute as frequency.

Set The Auto Delete For Old Azure Blobs Based On The Last Modified Time Using Azure Logic App

Step 6 - Set expiration age

Next, choose set tier age for the blob. Here, we need to give the value as -1(we need to change the tier for 1 days old blobs)

Set The Auto Delete For Old Azure Blobs Based On The Last Modified Time Using Azure Logic App

Step 7 - Mapping the blobs

Choose the folder of the blob

Set The Auto Delete For Old Azure Blobs Based On The Last Modified Time Using Azure Logic App

As

Set The Auto Delete For Old Azure Blobs Based On The Last Modified Time Using Azure Logic App

Step 8 - Mapping the conditions

Connecting the conditions

Set The Auto Delete For Old Azure Blobs Based On The Last Modified Time Using Azure Logic App

If the condition is true, then “delete blob”

Set The Auto Delete For Old Azure Blobs Based On The Last Modified Time Using Azure Logic App

The final workflow will be like this.

Set The Auto Delete For Old Azure Blobs Based On The Last Modified Time Using Azure Logic App

Now, let us save and run the workflow.

Output

First, check the old blob

Set The Auto Delete For Old Azure Blobs Based On The Last Modified Time Using Azure Logic App

Run the Logic App

Set The Auto Delete For Old Azure Blobs Based On The Last Modified Time Using Azure Logic App

Its successfully run

Set The Auto Delete For Old Azure Blobs Based On The Last Modified Time Using Azure Logic App

Just refresh the blob to see the result.

Set The Auto Delete For Old Azure Blobs Based On The Last Modified Time Using Azure Logic App

Now, it successfully turns the old blob tier got deleted.

Set The Auto Delete For Old Azure Blobs Based On The Last Modified Time Using Azure Logic App

Summary

I hope you understood how to set the Auto delete of the old Azure blobs based on the last modified time stamp using Azure Logic App. Stay tuned for more Logic App articles.