"Connect-MsolService: Exception of type was thrown" when you use the connect-MSOLService to connect to Microsoft 365, Azure, or Intune
When you try to use the connect-MSOLService cmdlet in the Microsoft Azure Active Directory module for Windows PowerShell to connect to a Microsoft cloud service such as Microsoft 365, Azure, or Microsoft Intune, your attempt is unsuccessful. You may also receive the following error message:
Connect-MsolService: Exception of type 'Microsoft.Online.Administration.Automation.MicrosoftOnlineException' was thrown.
This issue may occur for one or more of the following reasons:
- The Azure Active Directory module for Windows PowerShell rich client can't connect to the service. This is frequently the result of client computer readiness issues.
- The user ID that's used to authenticate is single sign-on (SSO)-enabled, and a client computer problem is preventing SSO communication with Active Directory Federation Services (AD FS), with the Microsoft Entra authentication system, or with both.
To resolve this issue, follow these steps:
- Troubleshoot Microsoft 365 rich client connectivity. For more information, see How to troubleshoot non-browser apps that can't sign in to Microsoft 365, Azure, or Intune.
- Troubleshoot common client configuration issues that limit SSO authentication. For more information, see Signing in to Microsoft 365, Azure, or Intune by using single sign-on doesn't work from some devices.
For more information about Azure Active Directory module for Windows PowerShell, see Microsoft Entra Cmdlets.