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


  1. 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..

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


Leave a Reply

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