$URL = "https://ps.outlook.com/powershell"
$Credentials = Get-Credential -Message "Enter your Office 365 admin credentials"
$EXOSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $URL -Credential $Credentials -Authentication Basic -AllowRedirection -Name "Exchange Online"
Import-PSSession $EXOSession
If got the error, "cannot be loaded because the execution of scripts is disabled on this system"
Set-ExecutionPolicy RemoteSigned