Our thinking


Installing PowerShell on macOS for remote administration of Microsoft 365

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

6 thoughts on “Installing PowerShell on macOS for remote administration of Microsoft 365

    1. Yes, good point – if this is not a clean install of macOS and Mac Ports, then there may be cruft remaining from previous installations that needs to be removed.

    2. Removing the folder was the key! After many long attempts I removed the folder then recreated it and the link.

Leave a Reply