Error when you try to run Azure Active Directory for Windows PowerShell cmdlets: The term <cmdlet name> is not recognized

Original product version:   Cloud Services (Web roles/Worker roles), Azure Active Directory, Microsoft Intune, Azure Backup, Office 365 Identity Management
Original KB number:   2669552

Symptoms

When you try to run Microsoft Azure Active Directory Module for Windows PowerShell cmdlets, you receive the following error message:

The term <cmdlet name> 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.

For example, you might see the following similar message:

The term 'Connect-MsolService' 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:20
+ Connect-MsolService <<<<
+ CategoryInfo : ObjectNotFound: (Connect-MsolService:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Cause

This issue can occur if the Azure Active Directory Module for Windows PowerShell isn't loaded correctly.

Resolution

To resolve this issue, follow these steps.

  1. Install the Azure Active Directory Module for Windows PowerShell on the computer (if it isn't already installed). To install the Azure Active Directory Module for Windows PowerShell, see Manage Azure AD using Windows PowerShell.

  2. Select Start > All Programs, select Windows Azure Active Directory, and then select Windows Azure Active Directory Module for Windows PowerShell.

  3. At the Windows PowerShell command prompt, type Get-Module, and then press Enter.

  4. In the output, check that the MSOnline module is present. The output should look similar to the following:

    Module Type Name Exported Commands
    -------------- -------- ----------------
    Binary MSOnline {Add-MsolRoleMember, Remove-MsolContact...
    

    If the MSOnline module isn't present, use Windows PowerShell to import the MSOnline module. To do this, follow these steps:

    1. Connect to Exchange Online by using remote PowerShell. For more info about how to do this, see Connect to Exchange Online Using Remote PowerShell.

    2. Type the following cmdlet, and then press Enter:

      Import-Module MSOnline
      

More information

Still need help? Go to Microsoft Community or the Azure Active Directory Forums website.