Exchange Online PowerShell on Mac

Matt Ellis
Oct 12, 2018 · 3 min read

I gave this a go back in 2016 when Microsoft announced PowerShell was available for Linux and Mac, but it was just a bit of a ballache so I kind of gave up.

The other day I thought I’d try this again and I had some success on my Mac running the latest Mojave 10.14 macOS.

Microsoft have published some pretty good instructions here with various options for installing PowerShell. I went with the recommended process of using Homebrew rather than direct download or using binary archives.

Installing Homebrew

This is pretty easy and instructions can be found here. It’s effectively just one command. Paste this into Terminal and hit Enter:

/usr/bin/ruby -e "$(curl -fsSL"

It will tell you what it’s gonna do and ask you to hit Enter to continue. Once you’ve done that you’ll need to enter your macOS administrator password to continue with the install.

After this it will go away and install Xcode (if required) and then proceed to install Homebrew. This took about 5 minutes on my machine.

You’ll know it’s finished when you see a screen similar to this:

Install PowerShell

This part is also very simple. Install PowerShell by pasting in the following command to your Terminal session and hitting Enter:

brew cask install powershell

Connect to Exchange Online

Now you need to connect to Exchange Online. You can use the instructions you’d use in Windows for this but essentially you need enter your credentials and establish a session.

$Creds = Get-Credential$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $Creds -Authentication Basic -AllowRedirectionImport-PSSession $Session -DisableNameChecking

Huge caveat here. You need to use an account that can use basic authentication. If your account requires MFA or your organisation has disabled legacy authentication methods you will see an error similar to below. As soon as it’s possible to use modern authentication on the Mac I will update this post.

If you have used an account where basic authentication is enabled you will be able to establish the session and run cmdlets as normal. Voila!

Remember to disconnect your PowerShell session once you’re done by running

365 UC

Stories from the world of UC by a bunch of UC professionals…

Matt Ellis

Written by

Unified Communications Architect, Pompey fan, burger eater, coffee drinker...

365 UC

365 UC

Stories from the world of UC by a bunch of UC professionals…

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade