Can't connect to Office 365, Azure, or Intune using the Azure Active Directory module for Windows PowerShell

This article describes an issue in which you can't connect to a Microsoft cloud service such as Office 365, Azure, or Microsoft Intune by using the Connect-MSOLService cmdlet.

Note

Azure AD and MSOnline PowerShell modules are deprecated as of March 30, 2024. To learn more, read the deprecation update. After this date, support for these modules are limited to migration assistance to Microsoft Graph PowerShell SDK and security fixes. The deprecated modules will continue to function through March, 30 2025.

We recommend migrating to Microsoft Graph PowerShell to interact with Microsoft Entra ID (formerly Azure AD). For common migration questions, refer to the Migration FAQ. Note: Versions 1.0.x of MSOnline may experience disruption after June 30, 2024.

Original product version:   Microsoft Entra ID, Microsoft Intune, Azure Backup, Office 365 User and Domain Management, Office 365 Identity Management
Original KB number:   2494043

Symptoms

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, Microsoft Azure, or Microsoft Intune, your attempt is unsuccessful. Instead, you receive one of the following error messages:

Connect-MsolService : Exception of type 'Microsoft.Online.Administration.Automation.MicrosoftOnlineException' was thrown.

Connect-MsolService : Access Denied. You do not have permissions to call this cmdlet.

Connect-MsolService : The user name or password is incorrect. Verify your user name, and then type your password again.`

Resolution

To resolve this issue, refer one of the following articles, as appropriate for your situation:

More information

For more information about Azure Active Directory module for Windows PowerShell, see Manage Microsoft Entra ID using Windows PowerShell.

Contact us for help

If you have questions or need help, create a support request, or ask Azure community support. You can also submit product feedback to Azure feedback community.