[Solved] the term ‘connect-msolservice’ is not recognized as the name of a cmdlet function

In this tutorial, we will discuss how to fix the error, the term ‘connect-msolservice’ is not recognized as the name of a cmdlet function. The error comes while trying to connect to Microsoft Azure to read users.

The full error comes as: 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.

While trying to connect to Msol service from Microsoft Azure Active Directory from Windows PowerShell.

the term ‘connect-msolservice’ is not recognized as the name of a cmdlet function

Follow the below steps to fix the error, the term ‘connect-msolservice’ is not recognized.

Step-1:

Open Windows PowerShell in administrator mode. Then run the following commands serially.

If you have installed already AzureAD PowerShell commands, then run the below command to uninstall.

uninstall-module AzureAD

Step-2:

Then run the below commands one by one.

install-module AzureAD
install-module AzureADPreview
install-module MSOnline

Step-3:

Then you can run the below command to connect to Azure from PowerShell.

Import-Module MSOnline

$credentials = Get-Credential

Connect-MsolService -Credential $credentials

Now, you can provide your Office 365 global administrator account.

You may like the following tutorials:

In this tutorial, we learned how to fix the error, the term ‘connect-msolservice’ is not recognized as the name of a cmdlet function. Also, it fixes the below issues:

  • the term connect-msolservice is not recognized
  • the term ‘connect-msolservice’ is not recognized as the name of a cmdlet fun
  • the term ‘connect-msolservice’ is not recognized as the name of a cmdlet function s
  • the term connect msolservice is not recognised
>