Connecting to Exchange Online with MFA Enabled


Connect to Exchange Online PowerShell with MFA Enabled.


If your organization is using MFA for all staff to provide an extra layer of security you might have found that connecting to Exchange Online using Remote PowerShell fails with an error “Access Denied”. For accounts with MFA enabled they cannot use the same method as non MFA enabled accounts to connect to Exchange Online.

MFA requires the you to install the Exchange Online Remote PowerShell Module, and then connect using the Connect-EXOPSSession cmdlet.

Error received:




To get started you need to download and install the Exchange Online PowerShell Module from the Exchange Admin Center.

  • Click on hybrid
  • Then click on configure for the Exchange Online PowerShell Module


Note. download the file using IE, if you use any other browser you might experience issue with installing the application.


Click on Install once the application download has completed.

Remote Management (WinRM) on your computer needs to allow basic authentication (it’s enabled by default). To verify that basic authentication is enabled, run this command in a Command Prompt:




If WinRM is authentication is not set to basic, run the following to set it to basic.

Next on the computer with the Exchange Online Remote PowerShell Module installed run the following cmdlet to connect to Exchange Online using MFA.

  • <UPN> is your Office 365 work or school account i.e.
  • The <ConnectionUri> and <AzureADUri> values depend on the location of your Office 365 organization as described in the following table:

Then Office 365 tenant being used for this demonstration is not in the locations specified below, so I will continue using the following cmdlet. To connect to Exchange Online.


Next you will be prompted to provide the password for the mentioned user.










Once you have provided the password for the user, you will be prompted to provide the security code.










Once the code has been entered and accepted the PowerShell modules will continue and Import in your PSSession.


And that is how you can still connect to Exchange Online even with MFA enabled on your user accounts.



Sharing is caring!

Previous articleExchange Online Backup and Restore: A Complete Guide
Next articleEnable Mailbox Auditing Office 365
About Me ? I Guess i would start by saying i am a family guys and full time SysAdmin and Tech Junky. This Blog is my first attempt to share information about daily issues i come across as a SysAdmin as well as some new deployments i am part of. Topics that i will cover will mostly be about Office 365,Windows,Exchange as well as Active Directory. I hope some of my Blog posts helps someone #LiveLongAndBeLazy #Exchange #Office 365 #ActiveDirectory #Hyper-V


Please enter your comment!
Please enter your name here