Connect to Exchange Online PowerShell from Linux Ubuntu 20.04

This Exchange Online and Ubuntu blog post will show how to connect to Exchange Online PowerShell from Linux Ubuntu 20.04.

Install PowerShell 7.1.3

Before we start, we must ensure we are running PowerShell 7.1.3 on our Ubuntu system. To install PowerShell on Ubuntu, visit the official Microsoft doc.

Install Exchange Online PowerShell Module

The next step in the process is to install the Exchange Online V2 PowerShell module. The module is supported on all platforms.

Start PowerShell on your Ubuntu systems using the following command.

pwsh

Run the below command to start the installation.

Install-Module -Name ExchangeOnlineManagement
Connect to Exchange Online PowerShell from Linux Ubuntu 20.04

Connect to Exchange Online PowerShell from Linux Ubuntu 20.04

After the installation is completed we can go ahead and connect to Exchange Online using the following command.

connect-exchangeonline -Device

WSMan Error

If you receive the following error message, check the section below on installing the WSMan Library, which will fix the connection issue/error.

This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or  unavailable for this system.</em></div>

Install WSMan Library

To install the WSMan Library on your Ubunto system, run the following three commands.

 sudo apt-get update -y
 sudo sh -c "yes | pwsh -Command 'Install-Module -Name PSWSMan'"
 sudo pwsh -Command 'Install-WSMan