Get SharePoint Online Tenant Settings using PowerShell

Requirement: Get tenant settings in SharePoint Online.

Get-SPOTenant: PowerShell to Retrieve Tenant Setting in SharePoint Online

To make the most of the SharePoint Online platform, it’s important to understand the various settings available and how they impact SharePoint’s behavior. In this blog post, we will show you how to use PowerShell to get tenant settings for SharePoint Online. This can be useful for troubleshooting issues or for gathering information about the settings configured for your tenant. With PowerShell, you will be able to quickly and easily get the information that you need.

Use the Get-SPOTenant cmdlet to get all the configuration settings of the tenant.

#Set SharePoint Online Admin Center URL
$AdminSiteURL="https://crescent-admin.sharepoint.com"

#Connect to SharePoint Online Admin Center
Connect-SPOService -Url $AdminSiteURL

#Get Tenant Settings
Get-SPOTenant

This cmdlet gets all the settings of the tenant (145 properties currently):

Get SharePoint Online Tenant Settings using PowerShell

Here’s a table with important properties that can be retrieved using the Get-SPOTenant cmdlet in SharePoint Online PowerShell:

PropertyDescription
AllowEditingAllows users to edit files in the Office Online client.
BccExternalSharingInvitationsEnables BCC for external sharing invitations.
BlockDownloadLinksFileTypeBlocks downloading of certain file types.
CommentsOnSitePagesDisabledIndicates whether comments are disabled on Site Pages.
ConditionalAccessPolicyThe conditional access policy applied to the tenant.
CoreRequestFilesLinkEnabledDetermines if the Request Files feature of OneDrive is enabled.
DefaultSharingLinkTypeThe default type of sharing link created for sharing documents and items.
DisableCustomAppAuthenticationIndicates whether custom authentication for apps is disabled.
DisableListSyncDetermines if syncing SharePoint lists to the Microsoft To-Do app is disabled.
DisablePersonalListCreationIndicates whether users can create personal lists in their OneDrive.
EnableAutoNewsDigestEnables the automatic news digest feature.
FileAnonymousLinkTypeThe type of anonymous link that can be used for files.
HideDefaultThemesIndicates whether the default themes are hidden from the theme picker.
IPAddressEnforcementEnforces logins from a specific IP address only.
IsLoopEnabledIndicates whether Microsoft Loop features are enabled.
LegacyAuthProtocolsEnabledAllows or prevents legacy authentication protocols.
NoAccessRedirectUrlURL to redirect users who have been blocked from accessing the tenant.
OneDriveForGuestsEnabledIndicates if OneDrive access for guests is enabled.
OneDriveStorageQuotaDefault storage quota for OneDrive users in megabytes.
SharingAllowedDomainListSpecifies the list of allowed domains that users can share with.
SharingBlockedDomainListSpecifies the list of blocked domains that users cannot share with.
SharingCapabilityOverall sharing capability setting for the tenant.
ShowEveryoneClaimIndicates whether the “Everyone” claim is visible in the people picker.
ShowEveryoneExceptExternalUsersClaimIndicates whether the “Everyone except external users” claim is visible in the people picker.
ShowPeoplePickerSuggestionsForGuestUsersShows suggestions in the people picker for guest users.
StorageQuotaTotal amount of storage that’s allocated to the tenant.
UseFindPeopleInPeoplePickerUse the Find People experience in the people picker.
UsePersistentCookiesForExplorerViewDetermines whether persistent cookies are used for the Explorer View.
ViewInFileExplorerEnabledSpecifies whether the “View in File Explorer” feature is enabled for document libraries in SharePoint Online.
Workflows2013StateThe status of 2013 workflows in the tenant.

To retrieve a specific property, use:

(Get-SPOTenant).CoreRequestFilesLinkExpirationInDays

Get SharePoint Online Tenant Settings using CSOM PowerShell

We can also use CSOM PowerShell to retrieve tenant settings in SharePoint Online:

#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
Add-Type -Path "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.Online.SharePoint.Client.Tenant.dll"

#Set Tenant Admin parameters
$AdminSiteURL = "https://crescent-admin.sharepoint.com"

#Get Credentials to connect
$Cred= Get-Credential

#Setup the context
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($AdminSiteURL)
$Context.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)

#Create tenant object and get tenant settings
$Tenant = New-Object Microsoft.Online.SharePoint.TenantAdministration.Tenant($Context)
$Context.Load($Tenant)
$Context.ExecuteQuery()

#Get All Properties of the Tenant
$Tenant | Select *

PnP PowerShell to retrieve Tenant Settings

The Get-PnPTenant cmdlet from PnP PowerShell can be used to retrieve the properties and settings of a SharePoint Online or Microsoft 365 tenant. Here’s how to use this cmdlet:

#Parameters
$AdminCenterURL = "https://Crescent-admin.sharepoint.com"
 
#Connect to PnP
Connect-PnPOnline -Url $AdminCenterURL -Interactive

#Get Tenant Settings
Get-PnPTenant

This retrieves all properties of the current tenant. To get specific properties of a tenant, use:

Get-PnPTenant | Select  StorageQuota, SharingCapability

The Get-PnPTenant cmdlet can retrieve a wide range of properties about a SharePoint Online tenant. Below is a table listing some of the important properties that you can access using this cmdlet:

PropertyDescription
CommentsOnSitePagesDisabledIndicates whether comments are disabled on Site Pages.
ConditionalAccessPolicySpecifies the conditional access policy for the tenant.
CoreRequestFilesLinkEnabledDetermines if the Request Files feature of OneDrive is enabled.
DisableAddToOneDriveControls whether users can add shared folders to their OneDrive.
DisablePersonalListCreationIndicates whether users can create personal lists in their OneDrive.
ExternalUserExpireInDaysSpecifies the number of days before a share to an external user expires.
HideDefaultThemesDetermines whether the default themes are hidden from the theme picker.
IPAddressAllowListDefines a list of allowed IP addresses that can access the tenant without enforcing conditional access policies.
MajorVersionLimitSpecifies the major version limit for document libraries.
NoAccessRedirectUrlURL to redirect users who have been blocked from accessing a site.
OneDriveRequestFilesLinkEnabledDetermines if the Request Files feature is enabled in OneDrive.
OneDriveStorageQuotaDefault storage quota for OneDrive users in megabytes.
SharingAllowedDomainListSpecifies the list of allowed domains that users can share with.
SharingCapabilityOverall sharing capability setting for the tenant.
ShowEveryoneClaimIndicates whether the “Everyone” claim is visible in the people picker.
ShowEveryoneExceptExternalUsersClaimIndicates whether the “Everyone except external users” claim is visible in the people picker.
SocialBarOnSitePagesDisabledIndicates whether the social bar on Site Pages is disabled.
StorageQuotaThe storage quota allocated to the tenant.
ViewInFileExplorerEnabledSpecifies whether the “View in File Explorer” feature is enabled for document libraries in SharePoint Online.

These properties provide administrative control over various SharePoint Online and OneDrive for Business settings, including security, sharing, and feature availability within the tenant.

Last but not least: Regularly update Your PowerShell Modules! To get new properties added to the tenant settings, ensure you frequently update the PowerShell modules.

Summary

In conclusion, retrieving the tenant settings in SharePoint Online using PowerShell is a straightforward process that can provide valuable insight into the configuration of your SharePoint environment. By following the steps outlined in this guide, you can easily retrieve the tenant settings and gain a deeper understanding of your SharePoint environment. Whether you’re an administrator or a developer, this guide will provide you with the necessary steps to retrieve the tenant settings and ensure that your SharePoint environment is set up to meet your needs.

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

5 thoughts on “Get SharePoint Online Tenant Settings using PowerShell

  • I am trying to do something in the new PnP module that is dead easy in the old SPO module: report space usage on the tenant:
    Get-SPOGeoStorageQuota | Select TenantStorageMB, GeoUsedStorageMB, GeoAvailableStorageMB
    In theory, Get-PnPTenant should return this information, but I can only return “StorageQuota” which is equivalent to “TenantStorageMB”, but I can’t get actual usage

    Do you know how I can get tenant.TotalSpace, tenant.UsedSpace from the PnP module?

    Reply
  • Hello !!
    Thanks for your article. I have a question about Set-SPOTenant. I would like to disable News Digest on one site of a tenant with this cmd:
    Set-SPOTenant -EnableAutoNewsDigest $false
    Is there a way to target only one site of the tenant and not the whole tenant?
    Thanks!

    Reply
    • This setting applies at the tenant level. But users can opt-out of news digest from the Notification settings from the SharePoint Home site!

      Reply
      • thanks for the fast reply 😀
        ok I see. I’ll disable it anyway 😀

        Reply

Leave a Reply

Your email address will not be published. Required fields are marked *