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.
$O365Cred = Get-Credential
$O365Session = New-PSSession –ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $O365Cred -Authentication Basic -AllowRedirection
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