Connecting to Exchange on Office 365. There are two methods, one from the Azure portal and one from your local PC.

Azure method –

Log into portal.azure.com and use your administrator account. Fire up the cloud powershell and execute the below command –

 Connect-EXOPSSession 

This will authenticate you to Exchange services without needing to input any further credentials or options. You will have full access to all the commands related to exchange online services.

Local PC method –

Download and install the “Microsoft Online Services Sign-In Assistant
Edit the below registry key on your PC to allow basic authentication.

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WinRM\Client
Allow basic - decimal 1

Once that has been done, run the below commands after each other. You will be prompted to enter your administrator credentials in the second command which will store them temporarily in a variable.

Set-ExecutionPolicy RemoteSigned

$UserCredential = Get-Credential

 $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

 Import-PSSession $Session

Note the 3rd command should be in a single entry.