How to connect to Exchange Online PowerShell when MFA is enabled
In this step by step article, we will show you how to connect to Exchange Online PowerShell when multi-factor authentication (MFA) is enabled against your Office 365 user administrator account.
1.Firstly, you will require to download and install the Exchange Online Remote PowerShell Module. You can obtain the Exchange Online Remote PowerShell Module via the Exchange Admin Center (EAC).
There are a couple of ways you can do this, firstly Login to https://portal.office.com and then click on Admin Centers > Exchange or you can go directly to the Exchange Admin Center via the following URL; https://outlook.office365.com/ecp
2. Once you are there, click on Hybrid and then click on configure as per the below image where it says “The Exchange Online PowerShell Module supports multi-factor authentication. Download the module to manage Exchange Online more securely”
3.This will download the required executable which should run automatically. Once installed, you will be presented with the following PowerShell Window
Alternatively, you can always re-run the application by searching for Exchange Online PowerShell Module via Windows > Programs
4. Once you are presented with the Powershell window, type the following command and syntax to connect and authenticate with your Exchange Online Tenant.
Connect-EXOPSSession -UserPrincipalName <useraccount>@<tenantname>.onmicrosoft.com e.g Connect-EXOPSSession -UserPrincipalName email@example.com
Enter your credentials when presented with the Sign in to your account window
Once you have authenticated with your credentials and MFA token, that’s it! You have successfully connected to Exchange Online.
To ensure you have connected, you can run a basic command like Get-Mailbox and you should see something similar to the below
Always remember to disconnect upon completion
Get-PSSession | Remove-PSSession
Don’t hesitate to get in touch with us by calling +61 2 9161 7171 or online via contact us with any Office 365 project that you may need assistance with.