Installing PowerShell on macOS for remote administration of Microsoft 365

Install PowerShell on macOS for remote Microsoft 365 administration, using MacPorts for the OpenSSL 1.0 build PowerShell needs and symlinking it into place.

There are a couple of catches to install PowerShell on macOS and have it work for remote sessions to Microsoft 365 / Azure AD / Exchange Online.

First, install the latest release version of PowerShell from GitHub:

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

Then, install MacPorts

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

After you have installed MacPorts, install the older version of OpenSSL that PowerShell requires. In Terminal, type:

sudo port install openssl10

After installing OpenSSL 1.0, make a symlink so that PowerShell can find it where it is looking for it

sudo mkdir -p /usr/local/opt/openssl sudo ln -s /opt/local/lib/openssl-1.0 /usr/local/opt/openssl/lib

Once this has been done, you can connect to MS365:

pwsh $UserCredential = Get-Credential $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection Import-PSSession $Session

Keep This Useful

Spotted something outdated or unclear?

If a step has changed, a screenshot no longer matches, or something here just does not work the way it should, get in touch and we will take a look.