The Term ‘Connect-AzureRmAccount’ is Not Recognized

Connect-AzureRmAccount

The Azure PowerShell AzureRM module is used for management and automation of Azure resources like VMs, VNets, etc.

If you try to connect to Azure without having the module installed you’ll encounter the following error message:

PS C:\> Connect-AzureRmAccount
Connect-AzureRmAccount : The term 'Connect-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
+ Connect-AzureRmAccount
+ ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Connect-AzureRmAccount:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

To fix this you must install the AzureRm PowerShell module.

AzureRM Pre-requisites

There are several pre-requisites that must be met before you can successfully install the AzureRm PowerShell module:

  • The AzureRm module is built on the .Net Framework so this must be present. Make sure you have version 4.7.2 or later. Install it from here if needed.
  • You must have PowerShell version 5.1 or later. Check your version using the following command:
PS C:\> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      17763  771
    • If PowerShell version 5.1 is not available you can install it from here.
  • You must have the NuGet package provider installed on your system. Check if it’s present using the following command:
PS C:\> Get-PackageProvider

Name                     Version          DynamicOptions
----                     -------          --------------
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
NuGet                    2.8.5.208        Destination, ExcludeVersion, Scope, SkipDependencies, Headers, ...
PowerShellGet            1.0.0.1          PackageManagementProvider, Type, Scope, AllowClobber, ...
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent
  • If NuGet is not present you can install it using the following command:
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force

Installing the Azure PowerShell AzureRM Module

If all pre-requisites are met you can install the AzureRm PowerShell module using the following command:

Install-Module AzureRm

Once the installation completes you should be able to connect successfully using the AzureRm module:

PS C:\> Connect-AzureRmAccount

Account                  SubscriptionName TenantId                             Environment
-------                  ---------------- --------                             -----------
admin@easy365manager.com Pay-As-You-Go    c1493123-2ba6-a49e-b462-e3e7cdbae630 AzureCloud

Summary

Hopefully this post was able to get you going with the AzureRm PowerShell module.

If you’re looking for an easy and simple way to manage your Office 365 users, mailboxes and licenses, have a look at Easy365Manager.

With Easy365Manager you can do all daily management inside the AD Users & Computers tool without having to constantly switch between the Office 365 portal, the Exchange Admin Center and PowerShell.

Easy365Manager is available as a fully functional 30 day trial.