This article explains How to Connect to Office 365 via PowerShell. There are lot of things you can do from the Portal, however for most of the tasks, you’ll need PowerShell. Please be sure to use it carefully as its a powerful tool, and can do a lot more than you can imagine.

  • To login to Office 365 via Azure PowerShell, it’s advised to install the latest version of PowerShell.
  • Prerequisite for Azure PowerShell is Microsoft Online Sign-in Assistant. You can download it from here.
  • You can install this on Windows 8, Windows 8.1, Windows 7 (SP1)*, Windows Server 2008 R2 (SP1)*
  • You can download the Azure PowerShell from the links below:
  • Install the Sign-in Assistant, and Azure Active Directory Module, and launch Windows Azure PowerShell as Administrator (ensure that you Run it as Administrator)
  • Run the following commands to connect with your Office 365 account:
    • Set-ExecutionPolicy = unrestricted
    • $cred = Get-Credential -Credential $user

    Enter the credentials for your Office 365 Admin account and hit OK.

    • Import-Module MSOnline
    • Connect-MsolService -Credential $cred
    • $msoExchangeURL = “https://ps.outlook.com/powershell/
    • $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $msoExchangeURL -Credential $cred -Authentication Basic -AllowRedirection
    • Import-PSSession $session

Now you are connected to Office 365 via PowerShell.

Please do not forget to share your feedback, or ask us a question by clicking here.

The following two tabs change content below.
Passionate for Latest Gadgets, a Computer geek by Hobby, and luckily Profession too. Started my career in 2005 with IBM, worked with Microsoft later. Back in 2009, started Pledge Technologies (www.pledgetechnologies.com) (parent company to Grishbi). We, at Pledge Technologies, provide IT Consulting to SMBs across US & UK. Specialized in Microsoft Technologies like AD, Exchange, etc., and lot of experience of Office 365 Migration for various clients. Grishbi is a platform where we express what we learned today, and share it with world.
%d bloggers like this: