A cloud-based service included in Microsoft 365, delivering scalable messaging and collaboration features with simplified management and automatic updates.
If the same account works in the Microsoft 365 admin center but fails in Connect-ExchangeOnline, the most common causes are Exchange Online PowerShell access, authentication method issues, or local PowerShell/module conditions.
Try this path:
- Use modern authentication syntax.
Connect-ExchangeOnline -UserPrincipalName ******@contoso.onmicrosoft.comConnect-ExchangeOnlineuses modern authentication and works for accounts with or without MFA. - If the connection still fails, verify that the account is enabled for Exchange Online PowerShell access. A successful portal sign-in does not guarantee PowerShell access. One documented cause is that the account does not have access to Exchange Online PowerShell.
- Check whether the account is in the correct Exchange admin role group.
In the Exchange admin center:
- permissions
- admin roles
- open the required role group, such as Organization Management
- add the user under Members
- save the change
- If security defaults are enabled in the tenant, use the modern authentication connection method for Exchange Online PowerShell.
- Test whether the connection actually succeeded by running an Exchange cmdlet after connecting:
If no errors appear and the cmdlet returns results, the connection is working.Get-AcceptedDomain - Check local PowerShell prerequisites if errors continue:
-
PowerShellGetandPackageManagementmust be installed for REST-based Exchange Online PowerShell connections. - If another module is conflicting, open a new Windows PowerShell window and connect before importing other modules.
-
- Check for profile path issues.
Connection commands can fail if the Windows profile path for the account contains special PowerShell characters such as
$. The documented workaround is to connect using a different account that does not have special characters in the profile path. - If the error is specifically Bad Request, another administrator may need to enable remote PowerShell for the account:
Allow 15–20 minutes for the change to take effect.Set-User -identity ******@contoso.com -RemotePowerShellEnabled $True - If the account uses federated authentication, and the identity provider or STS is not publicly available, a federated account cannot be used for the connection. In that case, use a nonfederated Microsoft 365 account for Exchange Online PowerShell.