How To: Connect to Office 365 using PowerShell


When managing Office 365, you may find that some tasks are easier using PowerShell rather than the Office 365 Admin portal. This guide will show you how to install the needed tools to connect to an Office 365 tenant.


  • x64 version of Windows 10, Windows 8.1, Windows 8 or Windows 7 Service Pack 1
  • Windows Server 2016, Windows Server 2012 R2, Windows Server 2012 or Windows Server 2008 R2 Service Pack 1
  • Office 365 Global Administrator Credentials

Download and Install Necessary Software Packages

  1. Download and install the 64 Bit version of the Microsoft Online Services Sign-In Assistant from
  2. Download and install the 64 Bit version of the Microsoft Windows Azure Active Directory Module for Powershell from

Connecting to Office 365 from Powershell

  1. Click Start and in the start search, type Azure. Locate and open Windows Azure Active Directory Module for Windows PowerShell

  2. Enter the command $UserCredential = Get-Credential and press the Enter key.
  3. In the Windows PowerShell Credential Request window, enter the address of your Office 365 Global administrator account and the password, then click OK.


  4. Finally, enter the command Connect-MsolService -Credential $UserCredential
    and press the Enter key.



You can now use the PowerShell commands to administer Office 365. For more information, visit:

Leave a Reply

Your email address will not be published. Required fields are marked *