Ubuntu : Connecting SharePoint Online using PowerShell

PnP cmdlet on ubuntu
PnP cmdlet on ubuntu

Hi All,

Greetings for the day 🙂  LIFE IS BEAUTIFUL 🙂

Today something new learning – completely new for me as well so sharing 🙂

Background : In our organization we have some users who are using M365 on Linux operating system. One of the user want some script to upload documents in SharePoint online document library. Since I never use Linux OS for connecting M365 using some script or PowerShell, need to do bit research starting with having Linux OS itself for testing

One of my friend courtesy he shared Ubuntu boo-table with me and I have Ubuntu and I am ready to test

Take away from this article :

  • Installing PowerShell on Ubuntu
  • Installing SharePoint online module
  • Installing SharePoint PnP online module
  • Connecting to SharePoint admin site
  • Executing other PnP online commands

So lets begin fun 🙂

Note : I am first time using Ubuntu so my knowledge regarding this is limited so in case if you have any suggestion / feedback / thought on article kindly please put in comment box

  • I have Ubuntu boo-table version “20.04.2.0LTS”
  • Navigate to “ubuntu software” for installing PowerShell as
Ubuntu - Navigating to ubuntu software
Fig : Ubuntu – Navigating to ubuntu software
  • Search for the “powershell” , select first option “powershell” as
Ubuntu - Navigating to ubuntu software - installing powershell
Fig : Ubuntu – Navigating to ubuntu software – installing powershell
  • Install the “powershell” as shown in below fig
Ubuntu - Navigating to ubuntu software - installing powershell
Fig : Ubuntu – Navigating to ubuntu software – installing powershell
 Ubuntu - Navigating to ubuntu software - installing powershell - powershell details
Fig : Ubuntu – Navigating to ubuntu software – installing powershell – powershell details
  • Once powershell installed successfully, open it
  • Search for the PowerShell app from apps and open
Ubuntu : PowerShell editor
Fig : Ubuntu – opening PowerShell editor
  • Once we have PowerShell, we are ready to install the module for SharePoint Online – Microsoft.Online.SharePoint.PowerShell
  • While installing we will get an warning for – “untrusted repository” as shown in below fig
  • Please press “A” and continue
 Ubuntu - PowerShell - installing module - "Microsoft.online.SharePoint.PowerShell"
Fig : Ubuntu – PowerShell – installing module – “Microsoft.online.SharePoint.PowerShell”
  • But still we need to use “Set-PSPRepository” cmdlet to set the “InstallationPolicy” for PowerShell repository for current user
  • To get the name of PowerShell repository we will use “Get-PSPRepository
  • Default PowerShell repository name is “PSGallery” as shown in below fig
  • Once we have PowerShell repository name we can set “InstallationPolicy” value to “Trusted” so that we are not prompted before installing modules from that source
Ubuntu - PowerShell - setting installation policy - "Trusted" for PowerShell repository using "Set-PSPRepository"
Fig : Ubuntu – PowerShell – setting installation policy – “Trusted” for PowerShell repository using “Set-PSPRepository”
  • Once we have set “InstallationPolicy” to “Trusted” for PowerShell repository we ready to install SharePoint Online module => “Microsoft.online.SharePoint.PowerShell” and SharePoint PnP online modules => “SharePointPnPPowerShellOnline” as
Ubuntu - PowerShell - Installing SharePoint PnP PowerShell online
Fig : Ubuntu – PowerShell – Installing SharePoint PnP PowerShell online
  • On successful installation of the respective module we are ready to execute sharepoint online commands 🙂
  • We are connecting using “Connect-PnPOnline” as shown in below fig
Ubuntu - PowerShell - executing cmdlet - "Connect-PnPOnline" - connecting to SharePoint Online
Fig : Ubuntu – PowerShell – executing cmdlet – “Connect-PnPOnline” – connecting to SharePoint Online
  • After successfully connection, we are ready to execute other commands
  • As in below fig we are executing “Get-PnPUser” cmdlet 🙂
Ubuntu - PowerShell - executing cmdlet - "Get-PnPUser" - fetching all users
Fig : Ubuntu – PowerShell – executing cmdlet – “Get-PnPUser” – fetching all users

Thanks for reading ðŸ™‚ If its worth at least reading once, kindly please like and share 🙂 SHARE ING IS CARING ðŸ™‚

Share In Teams:

Enjoy the beautiful life ðŸ™‚ Have a FUN ðŸ™‚ HAVE A SAFE LIFE 🙂 TAKE CARE 🙂

Prasham Sabadra

LIFE IS VERY BEAUTIFUL :) ENJOY THE WHOLE JOURNEY :) Founder of Knowledge Junction and live-beautiful-life.com, Author, Learner, Passionate Techie, avid reader. Certified Professional Workshop Facilitator / Public Speaker. Scrum Foundation Professional certificated. Motivational, Behavioral , Technical speaker. Speaks in various events including SharePoint Saturdays, Boot camps, Collages / Schools, local chapter. Can reach me for Microsoft 365, Azure, DevOps, SharePoint, Teams, Power Platform, JavaScript.

You may also like...

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

%d bloggers like this: