Install the following components on your system to connect to your Office 365 tenant using PowerShell:

Microsoft Online Service Sign-in Assistant for IT Professionals RTW
Select the appropriate version of your OS

You must be a tenant administrator (i.e. comany administrator, global administrator) to successfully establish a connection to your Office 365 tenant using PowerShell. Read here how to assign an admin role in Office 365.

You’re now ready to connect to your Office 365 tenant using PowerShell!

  • To do so, run the Windows PowerShell console as administrator
  • Enter the following PowerShell commands:
    Import-Module MsOnline
  • PowerShell prompts for you Office 365 tenant credentials.

You’re all set. Start managing your Office 365 tenant using this great overview of the Azure AD cmdlets.