If you are working with Office 365 and often needs to connect to Office 365 PowerShell, the below PowerShell script might come handy.

The PowerShell script uses simple error handling techniques and it’s capable of connecting to Office 365 over the Proxy.

Before you use the script, don’t forget to install the required software.

Microsoft Online Signin Assistant

Windows Azure Active Directory Module

Connect to Office 365 Using PowerShell