Get-AzureRmResourceGroup:术语 'Get-AzureRmResourceGroup' 未被识别为 cmdlet 的名称

Get-AzureRmResourceGroup : The term 'Get-AzureRmResourceGroup' is not recognized as the name of a cmdlet

我正尝试在 PowerShell 中从我的 Azure 订阅中检索资源组名称:

Get-AzureRmResourceGroup | select resourcegroupname

但是我收到以下错误:

Get-AzureRmResourceGroup : The term 'Get-AzureRmResourceGroup' 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
+ Get-AzureRmResourceGroup | select resourcegroupname
+ ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-AzureRmResourceGroup:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

我有 PowerShell 5.0 并导入了最新的 Azure 模块。为什么不包括这个?

我缺少 AzureRM 依赖项,所以我不得不 运行 以下命令:Install-AzureRM。之后,Get-AzureRmResourceGroup | select resourcegroupname执行成功。

您需要先使用以下命令安装 Azure RM 模块:

Install-Module AzureRM 

然后需要导入模块使用:

Import-Module AzureRM