首页 > 解决方案 > 如何使用 AzureRM cmdlet 删除存储帐户容器(blob),我的 power shell 版本是 5.1

问题描述

我尝试使用以下命令删除存储帐户:

Remove-AzureRmStorageContainer -StorageAccount $stg -ContainerName "002fc90e-dc20-40f5-bf2f-b4998c4d6a77g" -force -verbose

但我收到以下错误:

Remove-AzureRmStorageContainer : The term '**Remove-AzureRmStorageContainer' is not recognized** as the name of a cmdlet, function, script file, or operable program. Check the spelling 
of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Remove-AzureRmStorageContainer -StorageAccount $stg -ContainerName "0 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Remove-AzureRmStorageContainer:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

标签: azurepowershellazure-powershellpowershell-5.0

解决方案


如果您已升级到新的 Azure Powershell Az 模块,Enable-AzureRmAlias请在运行之前尝试运行cmdlet 。此 cmdlet 通过别名启用兼容模式,允许您使用现有脚本进行最少的修改,同时努力完全迁移到 Az。有关更多详细信息,请参阅将现有脚本迁移到 AzRemove-AzureRmStorageContainer


推荐阅读