Skip to content

Latest commit

 

History

History
55 lines (39 loc) · 2.09 KB

storage-blobs-container-delete-by-prefix-powershell.md

File metadata and controls

55 lines (39 loc) · 2.09 KB
title description services documentationcenter author manager editor ms.assetid ms.custom ms.service ms.workload ms.tgt_pltfrm ms.devlang ms.topic ms.date ms.author
Azure PowerShell Script Sample - Delete containers by prefix | Microsoft Docs
Delete Azure Storage blob containers based on a container name prefix.
storage
na
tamram
timlt
tysonn
mvc
storage
storage
na
azurecli
sample
06/13/2017
tamram

Delete containers based on container name prefix

This script deletes containers in Azure Blob storage based on a prefix in the container name.

[!INCLUDE sample-powershell-install]

[!INCLUDE quickstarts-free-trial-note]

Sample script

[!code-powershellmain]

Clean up deployment

Run the following command to remove the resource group, remaining containers, and all related resources.

Remove-AzureRmResourceGroup -Name containerdeletetestrg

Script explanation

This script uses the following commands to delete containers based on container name prefix. Each item in the table links to command-specific documentation.

Command Notes
Get-AzureRmStorageAccount Gets a specified Storage account or all of the Storage accounts in a resource group or the subscription.
Get-AzureStorageContainer Lists the storage containers associated with a storage account.
Remove-AzureStorageContainer Removes the specified storage container.

Next steps

For more information on the Azure PowerShell module, see Azure PowerShell documentation.

Additional storage PowerShell script samples can be found in PowerShell samples for Azure Blob storage.