Connecting to Exchange Online with remote PowerShell from a Mac

Yes! it is finally possible to connect to Exchange Online from PowerShell installed on MacOS. I noticed some tweets about this being possible on Linux earlier in the week so I thought I’d re-visit testing it on MacOS. PowerShell remoting has been available in the MacOs version since powershell-6.0.0-alpha.15, but it didn’t include the ability to specify a “ConnectionUri’ as the endpoint – it only worked with server names and IP addresses. powershell-6.0.0-alpha.17 which was recently released now includes this functionality.

The first thing you need to do it download and install the latest release from here, you’ll want to download at least powershell-6.0.0-alpha.17

Next launch PowerShell and confirm the version:

1
$PSVersionTable

We are now ready to run establish our remote session. First let’s define our credentials:

1
$UserCredential = Get-Credential

Then create the session:

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

And finally, import that session:

1
Import-PSSession $Session

Once connected you have all the Exchange Online cmdlets available to you:

I haven’t thoroughly tested it yet, but I look forward to spending some time using it soon!