While Trying to create a AutoLabel Policy

Vishwakiran K A S 0 Reputation points

I'm trying to create a AutoSensitivityLabelPolicy and rule from the below script


New-AutoSensitivityLabelPolicy -Name "TestPolicy" -Comment "Primary policy" -SharePointLocation "All" -Mode TestWithoutNotifications -ApplySensitivityLabel "SensitivityLabel101"

New-AutoSensitivityLabelRule -Name "Default" -Policy "TestPolicy" -ContentContainsSensitiveInformation @{"name"="ABA Routing Number";"mincount"="1"} -Workload SharePoint

However I get this error

rite-ErrorMessage : A server side error has occurred because of which the operation could not be completed. Please try

again after some time. If the problem still persists, please reach out to MS support.

At C:\Users\vkas001\AppData\Local\Temp\tmpEXO_tbzqtu1i.qcm\tmpEXO_tbzqtu1i.qcm.psm1:1204 char:13


          Write-ErrorMessage $ErrorObject
  • CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
  • FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-ErrorMessage

Write-ErrorMessage : |Microsoft.Exchange.Management.UnifiedPolicy.ErrorPolicyNotFoundException|Policy "TestPolicy" wasn't

found. Make sure you typed the policy name correctly.

At C:\Users\vkas001\AppData\Local\Temp\tmpEXO_tbzqtu1i.qcm\tmpEXO_tbzqtu1i.qcm.psm1:1204 char:13


          Write-ErrorMessage $ErrorObject
  • CategoryInfo : InvalidOperation: (:) [New-AutoSensitivityLabelRule], ErrorPolicyNotFoundException
  • FullyQualifiedErrorId : [TimeStamp=Fri, 24 May 2024 08:07:38 GMT],Write-ErrorMessage
Microsoft Exchange Online
{count} votes

1 answer

Sort by: Most helpful
  1. Faery Fu-MSFT 17,901 Reputation points Microsoft Vendor

    Hi @Vishwakiran K A S ,

    This error message indicates that PowerShell cannot find the policy named "TestPolicy". This may be due to several reasons:

    1. Incorrect policy name: Please make sure the policy name you entered is correct. In this case you should check if "Test Policy" is the correct policy name.
    2. Policy Not Created: If you did not successfully create the policy before trying to create the rule, you may see this error. Please make sure your New-AutoSensitivityLabelPolicy command has been executed successfully.
    3. Latency Issue: In some cases, newly created policies may take some time to take effect in the system. This error may occur if you have just created a policy and then immediately try to create a rule. In this case, you can try waiting for a while and try creating the rule again.

    Additionally, you can use the Get-Error command to get more detailed information about the error.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.