Connect to Exchange Online PowerShell from Linux Ubuntu 20.04

In this blog post, we will connect to Microsoft 365, Exchange Online using PowerShell from Ubuntu 20.04 machine.

Install PowerShell 7.1.3

Before we start, we first need to make sure 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 support 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

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.

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 


by