Connect to SharePoint Online PowerShell
Applies to: SharePoint Online
Topic Last Modified: 2016-08-09
Summary: Install the SharePoint Online Management Shell and connect to SharePoint Online.
Before you get started using PowerShell to manage SharePoint Online, make sure that the SharePoint Online Management Shell is installed and you have connected to SharePoint Online.
Install the SharePoint Online Management Shell by downloading and running the SharePoint Online Management Shell. You only need to do this once for each computer from which you are running SharePoint Online PowerShell commands.
To open the SharePoint Online Management Shell command prompt, from the Start screen, type sharepoint, and then click SharePoint Online Management Shell.
To connect to SharePoint Online, fill in the values for the $adminUPN and $orgName variables (replacing all the text between the quotes, including the < and > characters), and then run the following commands at the SharePoint Online Management Shell command prompt:
$adminUPN="<the full email address of a SharePoint Online global administrator account, example: email@example.com>" $orgName="<name of your Office 365 organization, example: contosotoycompany>" $userCredential = Get-Credential -UserName $adminUPN -Message "Type the password." Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential
When prompted with the Windows PowerShell credential request dialog box, type the password for the SharePoint Online global administrator account.
You are now ready to begin executing SharePoint Online commands.