0

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.
maxdj2k
  • 13
  • 6
  • Read the beginning of following : https://learn.microsoft.com/en-us/powershell/module/exchange/new-autosensitivitylabelpolicy?view=exchange-ps – jdweng Jun 19 '23 at 14:23
  • I'm confused as to what I should be looking for. I apologize as I've read this page multiple times, are you referring to the Exchange permissions in admin center? I tried using the New-AutoSensitivityLabelRule first just to see if that changed anything and I still get the same error. – maxdj2k Jun 19 '23 at 15:57
  • the link says "This cmdlet is available only in Security & Compliance PowerShell." – jdweng Jun 19 '23 at 21:23
  • I thought that the ExchangeOnlineManagement Module Connects you to Security and compliance PowerShell? Here is the link: https://learn.microsoft.com/en-us/powershell/exchange/connect-to-scc-powershell?view=exchange-ps I'm part of a regular Microsoft 365 Organization which is why i only use Connect-IPPSSession -UPN – maxdj2k Jun 20 '23 at 13:12
  • Check that you are connected properly : https://learn.microsoft.com/en-us/powershell/exchange/connect-to-scc-powershell?view=exchange-ps#how-do-you-know-youve-connected-successfully – jdweng Jun 20 '23 at 13:43
  • I can verify that I am connected properly. Referring back to my question, I'm able to use the Cmdlets Get-Label and Get-LabelPolicy which are also part of the ExchangeOnlineManagement Module, it's just those few that it doesn't recognize I.E New-AutoSensitivityLabelPolicy, Get-AutoSensitivityLabelPolicy, New-AutoSensitivityLabelRule, and a few others. – maxdj2k Jun 20 '23 at 14:14
  • You need to be assigned permission to use the methods : https://learn.microsoft.com/en-us/powershell/module/exchange/new-autosensitivitylabelpolicy?view=exchange-ps#description – jdweng Jun 20 '23 at 14:18

0 Answers0