Delete Azure blobs older than X number of days

This script deletes Azure blobs that are older than X days.Provide the Azure Storage Account name, access key and container name as input.A log file is created tracking the details of blobs that are deleted. Including the count of deleted blobs.You can create an Azure Automation

 
 
 
 
 
5 Star
(2)
1,249 times
Add to favorites
Windows Azure
10/12/2018
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Script doesnt delete files
    3 Posts | Last post November 02, 2018
    • Hi Manju,
      
      I ran the script, it creates a log file but doesnt delete the files.
      
      In the log file it says " Purging blob from storage" but doesnt delete it.
      
      Can you check the script and reply if it requires any modification.
      
      Thanks,
      Vishal
    • Hello Vishu53,
      
      Thank you for downloading my script. As a best practice, I comment out the cmdlet that makes changes to the system. I had commented out the below cmdlet which does the purging. I have uploaded the script again without commenting on the cmdlet. It should Remove the blobs now.
      
      #Remove-AzureStorageBlob -Container $container -Blob $blob_iterator.Name -Context $context
    • Hi Manju,
      
      Sorry for replying so late. I had already commented out the command, but still it doesnt delete. Please recheck.