If you are trying to connect to a Tenant as an admin using Multi-facto authentication this post is for you.
1. Go to the Exchange Admin Center
2. Go to Hybrid and then click on Configure to download the powershell module.
3. Run and Install the application.
4. The following window will pop up:
5. Use the following command, where <UPN> is your Office365 account.
Connect-EXOPSSession -UserPrincipalName <UPN>
6. Select Work or school account
7. Add your password and click on sign in.
8. In the verification window that opens, enter the verification code, and then click Sign in.
After the verification is completed you can start running commands for this Tenant.