Open https://outlook.office.com/ecp in Internet Explorer (yes, I know). Go to hybrid > setup and click the appropriate Configure button to download the Exchange Online Remote PowerShell Module for multi-factor authentication.
In the Application Install window that opens, click Install.
This will create a file on your desktop that you can use to run PowerShell with the Exchange Online Modules.
If you have AppLocker, a network home drive or other policies that would prevent you from running this, you’d need to move the file to an appropriate location on your C: drive and open it as Admin. To do this, you can call it from an Administrator PowerShell window:
& "C:\Folder\Microsoft Exchange Online Powershell Module.appref-ms"
Or you can create a batch file containing the path and run that as Admin.
"C:\Folder\Microsoft Exchange Online Powershell Module.appref-ms"
Once the special Powershell window is up, you’ll have to connect to the endpoint you need to execute commands on. See the commands below:
connect-ippssession -UserPrincipalName [email protected] -ConnectionUri https://ps.outlook.com/powershell
connect-ippssession -UserPrincipalName [email protected] -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid