1- Create the Logic App
2- As soon as you create the Logic app, you get to go to Designer part of it. Since we are creating the recurrence logic, we can start with inbuilt recurrence trigger:
3- Once you select the recurrence trigger, you get the screen where you can set the number of recurrences based on the need. As in below screen shot my logic will run once in every week:
4- After this you select the “New Step” where you get chance to select your blob storage. Search for Azure Blob Storage and select it:
5-After selecting the Blob storage, you have to select the action on that storage and we will select the list blobs operation since we will be listing the blobs first and then will perform further actions:
6-After this we need to select the Storage account where we need to list and delete the blobs and give connection name:
Click create button and then we need to select the container where our blobs reside and then click on new step:
7- Next step, we will create the Array where those blobs will be residing after fetching it. So, search for “Filter Array” keyword and select it:
8- After Array selection, we need to select the dynamic value which will be iterated from the array:
Then click on the “Edit in advanced mode” and provide this query “@less(item()?['LastModified'], addDays(utcNow(), -7))” which means that we will be checking the “LastModified” field and will filter which are later than 7 days from today( you can change this value as per your need).
9:Click on New Step and search for the “for each” for looping the array:
After selecting the for each loop, we need to give dynamic value to it and select the “body” parameter to it:
10 - Then click on the “Add an action” where we will be selecting the “Delete Blob” operation:
12- After this, we need to select the Blob Path which needs to be deleted and since it will be dynamic, we will choose the “Path” value for this:
13- Now your Logic app designer should look like this and if yes then you can save the changes:
15 - Run it:
That's all guys. Happy Azure!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.