If you are using multi-factor authentication, it is not possible to use the old method of connecting to Exchange Online. You will have to install the Exchange Online Remote PowerShell Module, and use the Connect-EXOPSSession cmdlet to connect.
You can install the PowerShell module by following these instructions:
Log on to Exchange admin center.
In the left menu, click on hybrid.
Click the configure button for the Exchange Online Remote PowerShell Module. This will start the installation.
In the Application Install that appears, click the Install button.
A shortcut will be placed on your desktop which will start PowerShell with the required modules.
You can manage Exchange Online through Powershell in a similar fashion as you would an on-premise Exchange. There are some differences between available cmdlets and what they do between on-premise Exchange and Exchange Online, but the majority are the same.
Using multi-factor authentication
The method mentioned below is deprecated and only works for non-MFA usage. If you are using multi-factor authentication, you will have to use the Exchange Online Remote PowerShell Module to connect to Exchange Online. Instructions can be found in this article.
Using PS remoting, the cmdlets for Exchange Online are imported through the internet, so first, you need to change the Powershell execution polic ...