Skip to content

brandonh-msft/ThePurge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure Storage Blob Purge tool

Sometimes our best ideas come back to bite us. In some cases that's our wallet. Have you been collecting data from a service for a long time, but maybe forgot to turn off the collection, then you get a huge bill for your storage account? This tool is here to help.

Getting started

  1. Required: .NET 6.0 SDK
  2. Clone the repo
  3. Explore the tool with dotnet blobpurge -h
Usage - BlobPurge <AccountName> <ContainerName> -options

GlobalOption                       Description
Help (-h, -?, --help)              Shows Help
AccountName* (-a, --account)       The name of the storage account from which to purge blobs
ContainerName* (-c, --container)   The name of the container within the storage account from which to purge blobs
Prefix (-p, --prefix)              The prefix match to use for purging blobs
AgeDays (-d, --days)               The max age of a blob before it is purged
SubscriptionId (-s)                The Subscription ID in which the Storage Account lives, otherwise will use your default subscription (see az account list)
ChunkSize (--chunksize)            The number of blobs to process in parallel [Default='10']
Confirm (-y, --confirm)            Don't prompt for confirmation before starting deletion
WhatIf (--whatif)                  Doesn't actually purge but rather lists the blobs that *would be* purged if the tool were ran without --whatif
Verbose (-v, --verbose)            Outputs more detailed messages as the tool executes

I suggest using --whatif when you're testing your Prefix (-p) or Age (-d) filters as this will ensure no deletes actually get executed.

This tool will use your Azure CLI, Visual Studio, or other interactive credentials if they're found on your system, else (I think?) it'll prompt you for creds and use those. If the account you're after isn't in your default subscription, you can specify its subscription ID with -s

** WARNING **

Deleting blobs is an irreversible operation, especially if you don't have Soft Delete turned on in your storage account/container. USE ACCORDINGLY

Good luck & enjoy!

About

A tool for purging Azure Blob storage of blobs matching a prefix and/or older than a specified date

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages