PowerShell: Install The Microsoft 365 Admin Modules on Apple Silicon MacBooks

I recently started using a MacBook Air as my primary laptop. In my line of work, I interact with Microsoft 365 and Azure AD through PowerShell on a regular basis. Modern authentication protocols require that the management modules be installed locally. I found the process of getting the MS365 PowerShell modules running on my MacBook Air to be a little more complicated than doing the same on Windows, but it wasn’t difficult.

The first step is to install PowerShell itself. The direct method is simple, but you can also use Brew after we install it for OpenSSL in the next step. For the direct route, download the latest (not pre-release) edition as a package from GitHub at https://github.com/PowerShell/PowerShell/releases Once the file finishes downloading, right click on it and chose “Open With” then pick the installer. Follow the on-screen prompts to complete the installation.

The admin modules we want to run require OpenSSL. It is used to facilitate PowerShell remoting. Getting it installed is the next step. The easiest method to install OpenSSL is to use the Homebrew package manager. Follow the instructions on their web site and run the newest version of the installation script in the Terminal app on your MacBook. You can use Brew to install PowerShell as well if you like (Bing/Google it).

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Follow the scripts prompts to complete the Brew install, be sure to follow the steps at the end to add Brew to your path.

Once you have Brew installed run the following commands (one line at a time, enter after each) to update Brew, install OpenSSL, and add it to your path.

brew update
brew install openssl
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile

To test the results type “OpenSSL” in the terminal and it should open to a OpenSSL> prompt. Type Help and press enter at that prompt to see a list of OpenSSL commands. Type exit and press enter to leave the OpenSSL session and return to your user prompt.

Now we can install the Web Services for Management (PSWSMan) modules for PowerShell. Again this is to enable PowerShell remoting so that our MacBook can exchange commands with the remote Exchange Online server(s). Open the Terminal and run the following commands, pressing enter after each line. Ignore the REM lines (being with #).

sudo pwsh
#Enter your password when prompted
Install-Module -Name PSWSMan
sudo pwsh
#Enter your password when prompted

Now we’re ready to install the admin modules themselves. In the same PowerShell console run the line below. Hit Y when prompted.

Install-Module -Name ExchangeOnlineManagement

You can verify that it, or any of the other modules installed with an easy one-liner. Run after each install, change the name to match each time. The command will list information like the version and path so you know it is installed and available.

Get-InstalledModule ExchangeOnlineManagement | Format-List

To manage, report on, and incorporate Azure AD objects in your other code, install the MsOnline module with the line below. Again, you’ll need to enter Y when prompted.

Next up is SharePoint. I admit that I don’t use it for much, but it does come in handy for migrations. You know the drill, the line is below.

Install-Module -Name Microsoft.Online.SharePoint.PowerShell

Don’t forget Teams.

Install-Module -Name MicrosoftTeams

There are a few more modules available but these are the ones I use enough to warrant pre-installing them. You see how easy it is to add more on-demand. Any that you install will need to be updated to function optimally, that process is out scope for this post but generally the command Upgrade-Module -Name ***** does the job. For information about maintenance and tips on how to use the modules you’ve just installed, see the source documents from the vendors below.

1 Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s