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 already installed 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.
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
You may also like:
- PowerShell Copy Item examples
- Exception calling ExecuteQuery with 0 argument(s): Unable to connect to the remote server error in PowerShell SharePoint Online
- PowerShell get file size
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com
Didn’t work for me
Worked perfectly. Windows 11. Thank you.