"The user name or password is incorrect" when you use connect-MSOLService to connect to Microsoft 365
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 Microsoft 365, Azure, or Microsoft Intune, your attempt is unsuccessful. Additionally, you may receive the following error message:
Connect-MsolService : The user name or password is incorrect. Verify your user name, and then type your password again.
Cause
This issue may occur if the user name or password that you're using is incorrect or if there's a problem with the user account.
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.
Solution
To resolve this issue, see You can't sign in to your organizational account such as Microsoft 365, Azure, or Intune.
More information
Still need help? Go to Microsoft Community or the Microsoft Entra Forums website.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for