Today’s PowerShell corner is brought to you in association with “Saving Money on Azure Storage Inc.” an imaginary consulting company, headquartered in Helsinki, that specialises in ensuring you don’t spend too much on Azure storage when it slowly gets out of hand.
I do a lot of Azure (and Office 365 for that matter) demos. Probably 3 or 4 a week in some form or another and coupled to prep/design of these demos, I create a surprising amount of stuff in my tenancies. One challenge with shoving stuff into Azure tenancies is that at some point, somebody has to pay for the stuff being used. It doesn’t add up to a whole heap, but we’d all rather not pay for services unless absolutely necessary, right?
Anyway, enough preamble. Let’s get down to it.
I was steadily shoving more and more stuff into Azure storage account containers. Blobs of various sizes and purposes (more on this in some other posts) were ending up in my storage accounts and I decided that I needed a simply, demo-friendly way of clearing them out. After all, they’re of no use once the demo is done.
As is so often the case, PowerShell was the weapon of choice to eradicate this problem from my life and using the Azure cmdlets, creating a small script that can be run on-demand (for instance as part of session closedown at the end of a demo) was an easy task.
Interestingly I’ve made the script significantly more complex than it needs to be so that I can demonstrate an oft forgotten piece of PowerShell functionality – using the cmdlet like options available to advanced functions that make use of the cmdletbinding construct.
Here’s the script – it’s self documented so self-explanatory.
Usual caveats apply – removing blobs can’t be undone, so be sure!
more to follow…