Using Logic Apps to delete files older than X number of days from Azure Blob Storage

%3CLINGO-SUB%20id%3D%22lingo-sub-281627%22%20slang%3D%22en-US%22%3EUsing%20Logic%20Apps%20to%20delete%20files%20older%20than%20X%20number%20of%20days%20from%20Azure%20Blob%20Storage%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-281627%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3ERecently%20I%20have%20had%20to%20the%20need%20to%20clean%20up%20some%20of%20my%20blob%20storage%20and%20keep%20it%20clean.%20This%20can%20be%20done%20using%20an%20Azure%20PowerShell%20Runbook%2C%20but%20I%20wanted%20to%20see%20if%20it%20could%20be%20done%20with%20little%20to%20no%20code.%20Azure%20Logic%20Apps%20are%20perfect%20for%20this.%20You%20can%20create%20some%20powerful%20stuff%20with%20Logic%20Apps.%20So%20in%20this%26nbsp%3B%3C%2FSPAN%3Earticle%3CSPAN%3E%26nbsp%3BI%20am%20going%20to%20show%20you%20how%20to%20remove%20files%20from%20Azure%20Blob%20Storage%20after%20X%20number%20of%20days%20using%20Logic%20Apps.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EYou%20can%20read%20more%20at%20%3CA%20href%3D%22https%3A%2F%2Fpixelrobots.co.uk%2F2018%2F10%2Fusing-logic-apps-to-delete-files-older-than-x-number-of-days-from-azure-blob-storage%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fpixelrobots.co.uk%2F2018%2F10%2Fusing-logic-apps-to-delete-files-older-than-x-number-of-days-from-azure-blob-storage%2F%3C%2FA%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-281627%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1850095%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Logic%20Apps%20to%20delete%20files%20older%20than%20X%20number%20of%20days%20from%20Azure%20Blob%20Storage%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1850095%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F849044%22%20target%3D%22_blank%22%3E%40Saqib-s%3C%2FA%3E%2C%26nbsp%3Bmeanwhile%2C%20you%20can%20also%20look%20at%20the%20Lifecycle%20Management%20feature%20of%20Azure%20Storage%2C%20which%20is%20much%20simpler%20to%20implement%20and%20manage%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fstorage%2Fblobs%2Fstorage-lifecycle-management-concepts%3Ftabs%3Dazure-portal%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fstorage%2Fblobs%2Fstorage-lifecycle-management-concepts%3Ftabs%3Dazure-portal%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1850208%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Logic%20Apps%20to%20delete%20files%20older%20than%20X%20number%20of%20days%20from%20Azure%20Blob%20Storage%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1850208%22%20slang%3D%22en-US%22%3EThanks%2C%20we%20did%20go%20this%20route%2C%20but%20unfortunately%20Life%20Cycle%20management%20doesn't%20work%20for%20Page%20Blobs.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1844703%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Logic%20Apps%20to%20delete%20files%20older%20than%20X%20number%20of%20days%20from%20Azure%20Blob%20Storage%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1844703%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F50205%22%20target%3D%22_blank%22%3E%40Richard%20Hooper%3C%2FA%3E%26nbsp%3BThe%20%22For%20Each%22%20action%20is%20now%20no%20longer%20available%2C%20can%20you%20help%20with%20a%20solution%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E-%20Edit%2C%20it%20is%20available%20just%20doesn't%20appear%20when%20you%20search%20%22For%20Each%22%2C%20it%20can%20be%20found%20under%20'Control'%3C%2FP%3E%3C%2FLINGO-BODY%3E
MVP

Recently I have had to the need to clean up some of my blob storage and keep it clean. This can be done using an Azure PowerShell Runbook, but I wanted to see if it could be done with little to no code. Azure Logic Apps are perfect for this. You can create some powerful stuff with Logic Apps. So in this article I am going to show you how to remove files from Azure Blob Storage after X number of days using Logic Apps.

 

You can read more at https://pixelrobots.co.uk/2018/10/using-logic-apps-to-delete-files-older-than-x-number-of-days-from-...

3 Replies

@Richard Hooper The "For Each" action is now no longer available, can you help with a solution?

 

- Edit, it is available just doesn't appear when you search "For Each", it can be found under 'Control'

@Saqib-s, meanwhile, you can also look at the Lifecycle Management feature of Azure Storage, which is much simpler to implement and manage:

 

https://docs.microsoft.com/en-us/azure/storage/blobs/storage-lifecycle-management-concepts?tabs=azur...

Thanks, we did go this route, but unfortunately Life Cycle management doesn't work for Page Blobs.