In this Azure PowerShell article, we will discuss the syntax and usage of the Remove-AzStorageContainer PowerShell command with examples.
You can use the Get-AzStorageContainer PowerShell command to retrieve the storage container from a specified storage account.
Table of Contents
The Remove-AzStorageContainer is a very good Azure PowerShell command that can help you to remove the storage container that you have specified with this command.
Below is the syntax of the Remove-AzStorageContainer PowerShell command.
Remove-AzStorageContainer [-Name] <String>
Let’s see an example of how to use the Remove-AzStorageContainer PowerShell command.
You can execute the below PowerShell command that can help you to delete the storage container named “azure-webjobs-hosts” that belongs to the storage account “demorg2913f”.
$mynewsARG = "DEMORG2" $mynewsAName = "demorg2913f" $mynewsAKey = (Get-AzStorageAccountKey -ResourceGroupName $mynewsARG -AccountName $mynewsAName).Value $myuctx = New-AzStorageContext -StorageAccountName $mynewsAName -StorageAccountKey $mynewsAKey Remove-AzStorageContainer -Name "azure-webjobs-hosts" -Context $myuctx
After executing the above PowerShell script, It prompted me to confirm the deletion process so just clicked on the Yes button and then I can able to delete the storage container successfully without any issues. You can check out the below screenshot for your reference.
Just to make sure, I reran the script and this time I got the output “Remove-AzStorageContainer: Can not find the container ‘azure-webjobs-hosts’.” which means the storage container has been deleted successfully.
Remove-AzStorageContainer PowerShell Command – Video Tutorial
In this Azure PowerShell article, we discussed the syntax and usage of the Remove-AzStorageContainer command with examples. Thanks for reading this quick article !!!