Install PowerShell on Ubuntu 20.04 and add support for AzureAD. #powershell @ubuntu #linux @Microsoft @Azure #linux-guy-try-windows

Hi I want t run PowerShell on my Ubuntu machine and also add support for Azure. Because soon I will try to set up some federation in Azure.

Below is from Microsoft
https://docs.microsoft.com/en-us/microsoft-365/enterprise/connect-to-microsoft-365-powershell?view=o365-worldwide
It is in Swedish but It says that Ubuntu 20.04 is not supported. I will be supported in the 7.1 release. The screenshot is from 2020-10-20

Ubuntu 20.04 support for Powershell

Star a terminal and run the command:

snap install powershell --classic

The run powershell

pwsh

Then we want to add support for AzureAD with this command:

Then register this gallery

Register-PackageSource -Trusted -ProviderName 'PowerShellGet' -Name 'Posh Test Gallery' -Location https://www.poshtestgallery.com/api/v2/

Then we add the AzureAD module

Install-Module AzureAD.Standard.Preview

Then we import the module

Import-Module AzureAD.Standard.Preview

Then we connect to AureAD

Connect-AzureAD

Then we open a browser and surf to https://microsoft.com/devicelogin and put in the code that you receive from above command.

Choose the account that you want to login to

You are in! You think!
But it will not work with standard PowerShell.
I just wanted to see how many read this far. Sure get pissed, but if I did the mistake you can handle it!

The only think you need to do different is run powershell preview instead. Thats all, I promise!

sudo snap install powershell-preview --classic

Now yo can run Azure commands like

Get-AzureADApplication

I hope I help someone out the with Ubuntu that want to work with Powershell!

Have a nice day!

2 Comments

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 )

Twitter picture

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

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.