"Access Denied" error when you use the connect-MSOLService cmdlet to connect to Microsoft 365


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, Microsoft Azure, or Microsoft Intune, your attempt is unsuccessful. Additionally, you may receive the following error message:

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


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.


This issue can be resolved by adding the member/user to an administrator role within Azure. For more information, see the article Add-MsolRoleMember.

More information

Still need help? Go to Microsoft Community or Microsoft Entra Forums website.