"Connect-MsolService: Exception of type was thrown" error when you use the connect-MSOLService cmdlet to connect to Office 365, Azure, or Intune

Applies to: Cloud Services (Web roles/Worker roles)Azure Active DirectoryMicrosoft Intune More

PROBLEM


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 Office 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.

CAUSE


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 Azure Active Directory authentication system, or with both.

SOLUTION


To resolve this issue, follow these steps:
  1. Troubleshoot Office 365 rich client connectivity. For more information, see the following Microsoft Knowledge Base article: 
    2637629  How to troubleshoot non-browser apps that can’t sign in to Office 365, Azure, or Intune 
  2. Troubleshoot common client configuration issues that limit SSO authentication. For more information, see the following Microsoft Knowledge Base article: 
    2530713  Signing in to Office 365, Azure, or Intune by using single sign-on doesn't work from some devices

MORE INFORMATION


For more information about Azure Active Directory Module for Windows PowerShell, see Manage Azure AD using Windows PowerShell.

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