Powershell / Azure Automation / Delete older Containers from Azure Storage Account

This will be a simple example of how you can delete older containers in the Azure storage account. I will use Azure automation to scan storage containers and delete those matching the certain date pattern.

First, you need to choose an existing one or create new automation account to run your Runbooks

 

You should put the script within your Runbooks under the process automation. You will have some useful tutorial Runbooks as well.

 

We will use connection name with information needed to authenticate with Azure so that we can manage Azure classic resources from Runbooks. You can create your own connection name if you like.

 

I used AzureClassicRunAsConnection connection name since is automatically created, with included SubscriptionName, SubscriptionID and CertificateAssetName

Adding new automation account process creates the following items in your Automation account

 

Edit PowerShell Runbook

 

And add PowerShell script

 

After that just publish the Runbook

 

And just schedule a new azure task and link with your Runbook.

 

Some useful links:

What is Azure Automation

Simplify cloud management with process automation

 

 

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *