我正在尝试从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模块。为什么不包括在内?
您需要使用以下命令首先安装Azure RM模块:
Install-Module AzureRM
然后,您需要导入模块以供使用:
Import-Module AzureRM