10

I'm trying to retrieve a resource group name from my Azure subscription in PowerShell:

Get-AzureRmResourceGroup | select resourcegroupname

But I get the following error:

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

I have PowerShell 5.0 and have imported the latest Azure module. Why is this not included?

Shui shengbao
  • 18,746
  • 3
  • 27
  • 45
Martin Erlic
  • 5,467
  • 22
  • 81
  • 153

2 Answers2

16

You need to get the Azure RM module installed first by using the following command:

Install-Module AzureRM 

Then you need to import the module for use:

Import-Module AzureRM
user1894814
  • 389
  • 1
  • 3
  • 12
  • 1
    The Az module seems to overlap with this one. This isn't working for me. I even tried this with the -AllowClobber which forced it to be installed but then the import line failed with errors indicating the assembly was already loaded. There seems to be overlap between the AzureRm and Az modules and the commands aren't working for me no matter what I do. – emirhosseini Mar 06 '19 at 19:52
  • 1
    Sorry for late reply to this but it may help others. Currently Az and AzureRM are not compatible with each other. Az is for PS Core as it's cross platform and is expected to replace AzureRM however to this date not all functionality has been ported across. The commands are supposed to be shorter with increased stability etc. In short using Az is a better option as it will be used as the future standard, if you are not restricted by it's current limitations. – user1894814 Jul 02 '19 at 04:59
  • That doesn't solve the problem in Powershell 7.3 – Dean Schulze Nov 28 '22 at 04:33
4

I was missing the AzureRM dependency so I had to run the following command: Install-AzureRM. Afterwards, Get-AzureRmResourceGroup | select resourcegroupname executed successfully.

Martin Erlic
  • 5,467
  • 22
  • 81
  • 153