The term ‘Get-AzureRmResource’ is not recognized

I also got this error The term ‘Get-AzureRmResource’ 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.

while executing the below cmdlet

$myVmName = 'MyNewVM'
 $myrsgName = 'newresgroup'
 $myvm = Get-AzureRmVM –Name $myVmName –ResourceGroupName $myrsgName

 $myResource = @{
 'ResourceName' = $myVmName
 'ResourceType' = 'Microsoft.Compute/virtualMachines'
     'ResourceGroupName' = $myrsgName
 }
 $myvmResource = Get-AzureRmResource @myResource
 $myvmId = $vmResource.Properties.VmId

You can see here

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

The exact error is

Get-AzureRmResource: The term ‘Get-AzureRmResource’ 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:12 char:18

  • $myvmResource = Get-AzureRmResource @myResource
  • ~~~~~~~
    • CategoryInfo : ObjectNotFound: (Get-AzureRmResource: String) [], CommandNotFoundException
    • FullyQualifiedErrorId: CommandNotFoundException

The term ‘Get-AzureRmResource’ is not recognized as the name of a cmdlet [Solved]

To fix this error, follow the same steps as above.

Login to the AzureRm Account using the below command.

PS C:\windows\system32> Login-AzureRmAccount

Next, install the AzureRm module using the below cmdlet

PS C:\windows\system32> Install-Module AzureRm

Click on the Yes button from the below pop-up

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

Now you can see below it started installing the AzureRm module.

The term 'Get-AzureRmResource' is not recognized as the name of a cmdlet how to fix

It should fix the issue now, but in case you get the error “No match was found for the specified search criteria and module name AzureRm”. You can follow my article. No match was found for the specified search criteria and module name ‘AzureAD’ to fix this error.