Exchange Online Let’s Do: Connect to Exchange Online Management Shell via Linux

In this article, I’ll let you know how to connect to Exchange Online Management Shell via Linux.

At first, we need to install PowerShell for Linux, that’s easy, just one command:

sudo snap install powershell — classic

After the PowerShell for Linux Installed, we can switch to PowerShell by a simple cmdlet:

pwsh

After we switched to PowerShell successfully, we can see the command line like this:

As we can see, I installed PowerShell 7.0.

Now, let’s connect to Exchange Online Management Shell via PowerShell for Linux.

That is also simple, just run the following command:

$O365Credential = Get-Credential

And then enter your user name and password (you should be a administrator of Exchange Online).

Then run the following command:

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $O365Credential -Authentication Basic -AllowRedirection

Finally run the following command:

Import-PSSession -Session $Session

It shows a warning, but thats okay, we still able to manage Exchange Online by the command line, just as shown below:

That’s all, we did it,cheers!

发表评论

电子邮件地址不会被公开。 必填项已用*标注