Connect to SharePoint Online Using Powershell

In this blog post, I will show you how I connect to SharePoint Online using PowerShell and access all the available management commands.

About SharePoint Online

SharePoint Online is one of the core services in Office 365 and it is also one of the most used product as part of the Office 365 offering with great features like Team Site and OneDrive sync.


When many Administrators don’t know is that many administrative tasks are only possible using the SharePoint PowerShell module.

Get Started

Below you will how I install the SharePoint Online PowerShell module on my Windows Server 2016 machines (Same for Windows 10) and connect to SharePoint Online.

Install Module

The first step in the process is to install the module using the command below.

I’ll go ahead and run it from my PowerShell client.

Install-Module -Name Microsoft.Online.SharePoint.PowerShell

Connect to SharePoint Online

Next, I will use the code below to connect to my SharePoint Online service.

I recommend you fill in the details next to $adminUPN and $orgName and save the file as .PS1.

Once saved run the script.

$orgName="Office365 Org Name"
$userCredential = Get-Credential -UserName $adminUPN -Message "Type the password."
Connect-SPOService -Url https://$ -Credential $userCredential

When I run the script I will be asked to enter my Global Administrator user name and password

View Available Commands

To view all the available commands that are available in the module I will run the code below.

Get-Command -Module Microsoft.Online.SharePoint.PowerShell