Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clean an Azure storage Blob container?

I just want to clean (dump, zap, del .) an Azure Blob container. How can I do that?

Note: The container is used by IIS (running Webrole) logs (wad-iis-logfiles).

like image 687
Néstor Sánchez A. Avatar asked May 03 '12 06:05

Néstor Sánchez A.


People also ask

What should you use to automatically delete blob from Azure blob storage?

We are pleased to announce that we have made an Azure Logic Apps template available to expire old blobs. To set up this automated solution in your environment: Create a new Logic Apps instance, select the “Delete old Azure blobs” template, customize and run.

How do you delete a container in Azure?

In the Azure portal, navigate to your storage account. Locate the Data protection settings under Data management. Select Enable soft delete for containers. Specify a retention period between 1 and 365 days.


1 Answers

A one liner using the Azure CLI 2.0:

az storage blob delete-batch --account-name <storage_account_name> --source <container_name> 

Substitute <storage_account_name> and <container_name> by the appropriate values in your case.

You can see the help of the command by running:

az storage blob delete-batch -h 
like image 180
joanlofe Avatar answered Sep 23 '22 00:09

joanlofe