As a SharePoint Online administrator you have several tools available to you for automating tenant administration. When you are setting up a new workstation it can be challenging to figure out what to install and where to get it. This post summarizes the various PowerShell tools available for managing your SharePoint Online tenant.
Microsoft Online Services Sign-in Assistant
The Microsoft Online Services Sign-In Assistant provides end user sign-in capabilities to Microsoft Online Services, such as Office 365. This is required for using most of the other modules in this post and is likely installed if you are using Office applications on your workstation.
Microsoft Online Services Sign-In Assistant for IT Professionals RTW
SharePoint Online Management Shell
This is used for performing core SharePoint Online service administration.
Option #1 Download and install the SharePoint Online Management Shell
- Download sharepointonlinemanagementshell_6112-1200_x64_en-us.msi
- Run the installer
- Once installed you can load this module into your scripts using:
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
SharePoint Online Management Shell
Option #2 Install the SharePoint Online Management Shell from the PowerShell Gallery
If your operating system is using PowerShell 5.0 or newer, you can install the
SharePoint Online Management Shell by using the following command:
Install-Module -Name Microsoft.Online.SharePoint.PowerShell
Announcing availability of SharePoint Online Management Shell from PowerShell Gallery
Office Dev PnP PowerShell Module
This solution contains a library of PowerShell commands that allows you to perform complex provisioning and artifact management actions towards SharePoint. The commands use CSOM and many can work against both SharePoint Online and SharePoint Server.
Install-Module SharePointPnPPowerShellOnline -AllowClobber
SharePoint Online Client Side Object Model (CSOM)
For scenarios that are not covered by the SharePoint Online Management Shell or the Office Dev PnP PowerShell module you will need access to the client side object module.
Installing Package without Visual Studio installed
- Download the NuGet Commandline:
- From the directory where you saved nuget.exe:
Nuget install Microsoft.SharePointOnline.CSOM -OutputDirectory C:\<TargetDIR>\SPO_CSOM
Azure Azure AD Management Shell
This is used for managing top tenant level settings and for managing user provisioning and licensing. This requires global administrator rights and will not be necessary for many SharePoint operations.
Azure ActiveDirectory V1
Please note that cmdlets in this module will be deprecated when the functionality of this module is migrated to the newer Azure Active Directory PowerShell V2 Module. We advise customers who are creating new PowerShell scripts to use the newer module instead of this module.
Install AzureAD Management Shell V1
- Download AdministrationConfig-V220.127.116.11-GA.msi
- Run the installer file
- Import the module in your script by running:
Azure Azure AD Management Shell (V2)
This is the newer module for managing AzureAD but does not yet contain equivalents for all V1 cmdlets. This GA release also does not include V2 cmdlets that are in preview.
Installing Azure AD Management Shell V2
Install-Module -Name AzureAD
Security and Compliance Center
In your role as a SharePoint Online Administrator you may also be asked to manage some or all of the Security and Compliance center in Office 365. Managing this requires the use of Remote Powershell.
Connecting to Security and Compliance Center:
#Enter credentials and establish connection $UserCredential = Get-Credential $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/" -Credential $UserCredential -Authentication Basic -AllowRedirection #Import cmdlets Import-PSSession $Session #Once you are done with your session be sure you disconnect Remove-PSSession $Session
Connect to the Office 365 Security & Compliance Center using remote PowerShell