The term ‘Get-AzureRmVM’ is not recognized as the name of a cmdlet

In this azure tutorial, we will discuss how to fix the error, The term ‘Get-AzureRmVM’ 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.

The term ‘Get-AzureRmVM’ is not recognized as the name of a cmdlet

I got the get-azureRmvm not recognized error while trying to execute the below cmdlet using PowerShell ISE in Azure.

$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
The term 'Get-AzureRmVM' is not recognized as the name of a cmdlet

The exact error is

Get-AzureRmVM : The term ‘Get-AzureRmVM’ 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:7 char:1

  • Get-AzureRmVM
  • ~~~~~
    • CategoryInfo : ObjectNotFound: (Get-AzureRmVM:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

To fix this what we need to do is

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

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

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

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

It should fix the issue now but in case if you are getting 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.

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

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

To fix this error, you need to follow the same steps like 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 if you are getting 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.

You may like following Azure tutorials:

In this Azure tutorial, we discussed how to fix the error, The term ‘Get-AzureRmVM’ is not recognized as the name of a cmdlet and The term ‘Get-AzureRmResource’ is not recognized as the name of a cmdlet I hope it helped you to fix your issue.

Leave a Comment