Installing PowerShell Core on macOS and connect to Office 365 Tenant

This is the official link that explain how to do it in the Microsoft’s way :

First, we need to install “BREW”…

Open Terminal

Now, we need to install Homebrew ( see this guid: )

This is the command:

/usr/bin/ruby -e “$(curl -fsSL”

this is the output:

when finished, run this command:

brew cask install powershell

At this point lunch  it ! 

this is the command : 


Now , we can connect to our 365 tenant ( see this Guide:

Install-Module MSOnline

and then 

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $UserCredential -Authentication Basic -AllowRedirection


Import-PSSession $Session

UPDATES 21 June 2021 ……

If i launch the powershell i receive this warning..

So let’s go, We will update our PWS from 7.1.0 to 7.1.2!

the first thing to do, is to update your HOMEBREW using this command : brew update

in my case i found an issue because my brew was a “shallow clone”.. so i was obligated to to also this:

git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch –unshallow


git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch –unshallow

Now we can issue the “brew update” to verify everything is ok

now issue the command to update your Powershell:

brew upgrade powershell –cask



  1. I have an error:

    New-PSSession: This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system.

  2. Hi, do you know if anyone have success logging into exchange online with MFA?

  3. Have you ever tried any Cmdlets after connecting?

    “Get-MsolAccountSku : Could not load type ‘System.ServiceModel.WSHttpBinding’ from assembly ‘System.ServiceModel, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089’.”

    • Hi Robin,
      yes, there are some problems with Powershell under osx… First, you have to update your osx Powershell with this command : brew cask upgrade powershell
      I’ve done some check and i notice that, some command aren’t present..
      If i issue the Get-MsolAccountSku I have this output.. :
      S /Users/Netrek> Get-MsolAccountSku
      Get-MsolAccountSku : The term ‘Get-MsolAccountSku’ is not recognized as the name of a cmdlet,

      At this point, i think that the PShell to manage 365 under Osx is only to make some quick task and not to work ..


      • I use to do most daily Office 365 tasks from Powershell on Mac.
        DLs, users, calendars, meeting rooms and many others.

        So no, this can be used to accomplish most part of daily work.

        For example, room create in a bulk:
        Import-csv .\confRooms.csv | foreach{ New-Mailbox -Name $_.roomname -Room -PrimarySmtpAddress $_.emailaddress -ResourceCapacity $_.capicity -Office $_.Location}

        But when it is related to Azure’s part of my office tenant (Office based on Azure simplest Ad, you know), i have to use my windows VM.

        @robin68 – Get-MsolAccountSku is a part of msonline module which is not yet available in powershell core
        @blog – you should just try to google for “The term ‘Get-MsolAccountSku’ is not recognized as the name of a cmdlet” 🙂

        • Thanks Yuri and sorry for the delay, but during this days i’m very busy to support a big hotel opening soon in Venice..


Leave a Reply

Your email address will not be published. Required fields are marked *