About Me

My photo
I am an MCSE in Data Management and Analytics, specializing in MS SQL Server, and an MCP in Azure. With over 19+ years of experience in the IT industry, I bring expertise in data management, Azure Cloud, Data Center Migration, Infrastructure Architecture planning, as well as Virtualization and automation. I have a deep passion for driving innovation through infrastructure automation, particularly using Terraform for efficient provisioning. If you're looking for guidance on automating your infrastructure or have questions about Azure, SQL Server, or cloud migration, feel free to reach out. I often write to capture my own experiences and insights for future reference, but I hope that sharing these experiences through my blog will help others on their journey as well. Thank you for reading!

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!!