I'm trying to use PowerShell to create a new auto labeling policy for a test SharePoint site. Every time I login in to use the security and compliance PowerShell I can use the Cmdlets Get-Label and Get-Label policy, but not to create new Auto Labeling Policies such as New-AutoSensitivityLabelPolicy or New-AutoSensitivityLabelRule. In my organization I have Global Admin permissions, and I changed my role permissions in MS Purview to a Security Administrator, but the Cmdlet still isn't recognized. Anyone else have an idea?
1. Install-Module -Name ExchangeOnlineManagement
2. Import-Module ExchangeOnlineManagement
3. Connect-IPPSSession -UserPrincipalName user@domain.com
4. New-AutoSensitivityLabelPolicy -Name "Confidential auto-labeling policy" -SharePointLocation "Linktosharepointsite.com" -ApplySensitivityLabel "Confidential" -Mode TestWithoutNotifications
And here is the error for extra reference:
New-AutoSensitivityLabelPolicy : The term 'New-AutoSensitivityLabelPolicy' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.