Our thinking


Connect to Exchange Online using PowerShell on macOS – now 100% native arm64/Apple Silicon

I thought this update warranted a new post, instead of updating the previous one.

If you follow the instructions in my older post, this should get you a working PowerShell environment that will connect to Exchange Online using the ExO V2 cmdlets from Microsoft, with a huge thanks to Jordan Borean and his PSWSman / OMI implementation.

Following the instructions above will work on an Intel Mac or on an Apple Silicon Mac, however the Apple Silicon Mac will be running the entire toolchain under Rosetta translation.

Now, technically, there’s nothing wrong with this as you’re unlikely to be doing any kind of heavy lifting that would be slowed down by translating code from a different architecture, however it’s always nice to know that your shiny new Apple Silicon Mac is running native arm64 code whenever it can.

Here’s how to achieve your goal:

Go to the Releases page for PowerShell, and you’ll notice that since v7.2.0 there is now an osx-arm64 build. Download and install it.

https://github.com/PowerShell/PowerShell/releases

Next, install MacPorts

https://github.com/macports/macports-base/releases

If you prefer to use HomeBrew, this will also work – and save you an additional step later on in the process. I’ve been using MacPorts since forever, so I’m not going to change. Yeah, keep off my lawn while you’re at it.

Once they’re both installed, make sure that OpenSSL is installed. I think Brew might install OpenSSL by default, and MacPorts does, but it never hurts to just make 100% sure.

sudo port install openssl

Note that now you no longer need to install the Universal build, this will work with the Apple Silicon build.

After making sure OpenSSL is installed, if you’re using MacPorts you will also need to make sure that the Curl CA bundle is installed. For some reason, this isn’t installed by default and it’s needed by OpenSSL to verify the SSL certificate when connecting to Exchange Online.

sudo port install curl-ca-bundle

From here on, the instructions are the same as previously…

Launch PowerShell as root via sudo pwsh

Once you’re in PowerShell, run the following commands:

Install-Module -Name PSWSMan
Install-WSMan
Install-Module -Name ExchangeOnlineManagement
exit

Technically, only the Install-WSMan command needs to be run as root, so if you’re feeling paranoid you can adjust these instructions to suit.

Once this has completed, you can launch PowerShell once more and connect to Exchange Online via Connect-ExchangeOnline

This connection method will then launch your preferred browser to authenticate, including handling any MFA prompts, and then pass an authentication token back to the PowerShell session.

6 thoughts on “Connect to Exchange Online using PowerShell on macOS – now 100% native arm64/Apple Silicon

  1. I can’t thank you enough for this simple procedure to make it work something I have been looking for and spent hours following complex process without success. Great job mate !!

    1. I’m glad it worked for you too. It’s really not difficult once you get all the pieces of the puzzle worked out, and it’s great that everyone has updated all the relevant libraries so it’s finally a fully native workflow.

  2. I’ve not had any luck. I’m stuck getting this error when I try to Connect-ExchangeOnline
    Exception: Connecting to remote server outlook.office365.com failed with the following error message : error:16000069:STORE
    routines::unregistered scheme For more information, see the about_Remote_Troubleshooting Help topic.

    Any ideas?

Leave a Reply