It’s a good thing to enable multi-factor authentication (MFA) for Office 365 administrators. For web based management portals this is not a problem, just enter your username and password, wait for the text message to arrive, enter it in the additional dialog box and you’re in.
For PowerShell this has been more difficult, but MFA for PowerShell is available as well for some time now. When you login to the Exchange Admin Center and select hybrid in the navigation pane you can configure a hybrid environment (first option) or install and configure the Exchange Online PowerShell MFA module.
Click on the second configure button, and in the pop-up box that appears click Open to start the installation of the PowerShell module:
In the application install warning that pops up next click install. If you look closely you’ll notice that this download is stored somewhere in a Microsoft Azure storage account
After a couple of seconds the PowerShell module is installed. When you click the Start button and type “PowerShell” you’ll see it appear:
When you start it, a regular blue PowerShell windows appears:
You can connect to Exchange Online using the following command:
Connect-EXOPSSession -UserPrincipalName <tenant admin>
A credentials pop-op will appear, and after entering your credentials a second pop-up will appear. Enter the verification code you’ve received on your mobile device and you’re good to go.