We all know how important PowerShell has become, so it important to be able to establish a connection to Office 365.
Some things just can’t be done through the web-based GUI that Microsoft provides (or take a lot longer to do. Think repetitive tasks).
The 3 commands you will need to connect are:
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://ps.outlook.com/powershell/" -Credential $cred -Authentication Basic -AllowRedirection
Enter these one at a time, and you’ll then be connected to Office 365 Exchange!
You can verify the connection with the very simple command to show you a list of all your users: