How Do I Use Exchange Powershell in Office 365

If like me you are used to doing the majority of your Exchange Administration through powershell then you may find that during your first foray into Office 365 that by default the standard Exchange powerhshell command lets will not work.

This is because the standard powershell is not connected to the Azure / Office 365 backend. We also need to install a different version of powershell. Below I go through the steps to connect to the Office 365 Exchange Powershell.

First download and install the Azure AD Powershell, download the correct version for your OS.

Once downloaded and installed we run the following commands.

Set-ExecutionPolicy Unrestricted
Import-Module MSOnline
$O365Cred = Get-Credential
$O365Session = New-PSSession –ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $O365Cred -Authentication Basic -AllowRedirection
Import-PSSession $O365Session
Connect-MsolService –Credential $O365Cred

You will then be prompted for authentication, use a Global Administrator for 365. Once done you will find that you can then run standard Exchange Powershell commands in Office 365 such as get-mailbox etc.

Tags: O365, powershell

Allen White

Allen is a Consultant for ITPS in the North East of England and holds the following accreditations. MCSA, MCSE, MCTS, MCITP, CCA, CCSP, VCP 4,5 and HP ASE, AIS - Network Infrastructure.

Leave a comment

Categories

Vote!

What Web Browser Do You Use?

View Results

Loading ... Loading ...

Vote!

What do you prefer..VMware or Hyper-V?

View Results

Loading ... Loading ...