Search Suggest

how to fix Powershell error – The term ‘Login-AzureRmAccount’ is not recognized as the name of a cmdlet, function, script file, or operable program

Powershell error – The term ‘Login-AzureRmAccount’ is not recognized as the name of a cmdlet, function, script file, or operable program



When you try to execute Azure powershell command from powershell you get below error.
Here i have executed Login-AzureRmAccount and got below error:-

Login-AzureRmaccount : The term 'Login-AzureRmaccount' 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
+ Login-AzureRmaccount
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Login-AzureRmaccount:String) [], CommandNotFoundException

    + FullyQualifiedErrorId : CommandNotFoundExceptio





It means you do not have Azure PowerShell module installed on your system or server.
in order to install it.. 
1. you will execute below command 

PS >$PSversionTable.PSVersion

if it shows the Major version is 4, then we need to upgrade our system to execute azure powershell command in powershell console.

PS C:\Users\Administrator.ADVEN> $PSversionTable.PSVersion
Major  Minor  Build  Revision
-----  -----  -----  --------

4      0      -1     -1




2.Run the below command to check if you have PowerShellGet installed on your system:

PS c:\> Get-Module PowerShellGet -list | Select-Object Name,Version,Path

I am not getting any reply after executing above command in the powershell console.




Hence, in order to execute the powershell module, we have to follow below steps..
A. We have to install Get PowerShellGet Module

Question: What is PowershellGet

Ans:PowershellGet is an in-box module in the following release
  • Windows 10 or newer
  • Windows Server 2016 or newer
  • Windows Management Framework (WMF) 5.0 or newer
  • PowerShell 6

Now we will Get PowerShellGet module for PowerShell versions 3.0 and 4.0

in order to get this download PackageManagement MSI
 - from microsoft site

https://www.microsoft.com/en-us/download/details.aspx?id=54616


and install on the system or server. 



select the file as per version on your system. 



at this stage you are installing  Windows Management Framework 5.1
it will take some time..


 Now Restart the system or server.
Then execute below command to see the 


PS C:\Users\Administrator.ADVEN> Get-Module PowerShellGet -list | Select-Object Name,Version,Path

Name                                    Version                                 Path
----                                    -------                                 ----
PowerShellGet                           1.0.0.1                                 C:\Program 
Files\WindowsPowerShell\M...

PS C:\Users\Administrator.ADVEN>

please note before installation of  PackageManagement MSI above command was not returning any result.

This indicate power shell Get module is successfully installed in my system.

Get the latest version from PowerShell Gallery
Before updating PowerShellGet, you should always install the latest Nuget provider.
 To do that, run the following in an elevated PowerShell session. 
PS > powershell Install-PackageProvider Nuget –Force



Now execute below command to install

Install-Module –Name PowerShellGet –Force

Now we can easily install the Azure PowerShell from the PowerShell Gallery by runnign following command:

PS C:\> Install-Module AzureRM





On every prompt type ‘Y’ to proceed ahead.

While Installing the module you will see this screen like 


it will take some time and then AzureRM module will get installed.

Finally you just need to import the AzureRM module:

PS C:\> Import-Module AzureRM

then it will start working..




hence the issue of 
Powershell error – The term ‘Login-AzureRmAccount’ is not recognized as the name of a cmdlet, function, script file, or operable program

gets resolve and

PS C:\Users\Administrator.ADVEN> $PSversionTable.PSVersion


Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      14409  1005

shows major version 5 and we are able use login-AzureRmAccount powershell command


Happy Learning!!




Post a Comment