Close

Blob Delete via Azure CLI

I wanted to delete all blobs from a blob container. In Storage Explorer you can only delete blobs per page, so I looked for an alternative. One option is to use Azure Command Line Interface (CLI). Powershell scripts can also be run from a Azure DevOps CD pipeline. Nice to have an easy-to-use interactive interface.

Go to: https://shell.azure.com/

  • Log in with your Azure account
  • Connect with a Azure Subscription
  • Create a Storage Account (obligatory step).

After that your Azure Cloud Shell will be instantiated. You can select either Powershell or Bash.

Now, as I said I wanted to delete all blobs from a blob container. This is the Powershell command:
az storage blob delete-batch –connection-string “DefaultEndpointsProtocol=https;AccountName=[];AccountKey=[];EndPointSuffix=core.windows.net” –source [blobcontainer]

You will find a Azure CLI reference at docs.microsoft.com.