Site classification with PnP

2022-05-16

First: Enable the capability

Site classification has to be enabled at the Azure AD level. After enabling the site classification capability at the Azure AD level, you see an additional field How sensitive is your data? while creating new sites. Site classification allows you to define the sensitivity of your data on site level and group your sites based on the sensitivity of the information they contain.

You can enable the capability using Enable-PnPSiteClassification cmdlet.

If you are interested in more details, you can find them in a more dev-oriented Implement Sharepoint site classification solution Guidance from Microsoft.

If you are getting any errors at this point, you may want to resort to AzureADPreview Powershell module and check your AD settings for any existing templates, using Get-AzureADDirectorySetting cmdlet.

Troubleshoot with AzureADPreview module

# Install the Azure AD Preview Module for PowerShell
Install-Module AzureADPreview

# Connect to Azure AD
Connect-AzureAD

# Get existing settings
Get-AzureADDirectorySetting

If you see any existing settings like in the screenshot above, probably someone else in your organization already set them.

Verify the existing site classification

Using PnP

Use Get-PnPSiteClassification cmdlet to retrieve the existing site classification settings. As a result, you receive the values of UsageGuidelinesUrl, Classifications, and DefaultClassification. DefaultClassification value has to be also in the list of values you see under Classifications.

Get-PnPSiteClassification

Using AzureADPreview

Use Get-AzureADDirectorySetting cmdlet to retrieve the existing site classification settings. As a result, you receive the values of UsageGuidelinesUrl, Classifications, and DefaultClassification.

Results

In the User Interface you can see these values when you create a new site:

Update Site Classification

Use Update-PnPSiteClassification cmdlet to set the available classifications or usage guidelines url.

Update Site classification options

Update-PnPSiteClassification -Classifications "HBI", "CRI", "LBI"

Update usage guidelines url

Update-PnPSiteClassification -UsageGuidelinesUrl "https://powershellscripts.github.io/"

See Also

Another solution for classifying your sites - sensitivity labels, offering a more holistic approach on entire tenant scale, including also e.g. Exchange Online
Protecting your information: the power of labels
Sensitivity labels: Powershell your way around
Audit your sensitivity labels with Powershell

Absolutely necessary one-time step to enable sensitivity labels on site level:
Sensitivity labels: Enable labels for groups and sites