To connect to the Office 365 remote PowerShell, type the follwoing 3 commands in your local PowerShell:
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $o365cred -Authentication Basic –AllowRedirection
If you get an error at this stage about the execution of scripts being disabled on the system, you should close Powershell and run again as Administrator. Then run the following command to allow the scripts to execute and start the sequence of commands again.
Updated: April 15, 2016