Microsoft365DSC icon indicating copy to clipboard operation
Microsoft365DSC copied to clipboard

SCSensitivityLabels | Setting Label Priority

Open tayhall opened this issue 1 year ago • 0 comments

Description of the issue

The issue seems to be around child labels and setting their priority. The issue can be replicated with the Powershell Set-Label so its not a DSC bug as such but maybe one that needs to be worked around?

If the priority of a child label is attempted to be set the numbering has a mismatch and gives an error.

Simple example with the following labels

image

Then running the following $Labels = Get-Label -IncludeDetailedLabelActions ForEach ($Label in $Labels) { $Priority = $Label.Priority Set-Label -Id $Label.Id -Priority $Priority }

Produces these errors which are the same errors found when DSC is trying to set values on the labels.

Write-ErrorMessage : Microsoft.Exchange.Management.UnifiedPolicy.InvalidSubLabelPriorityException The priority 1 for sub-label is invalid and should be in the range for 2 - 3.

CategoryInfo : NotSpecified: (:) [Set-Label], InvalidSubLabelPriorityException FullyQualifiedErrorId : [TimeStamp=Mon, 23 Sep 2024 10:09:20 GMT],Write-ErrorMessage

Write-ErrorMessage : Microsoft.Exchange.Management.UnifiedPolicy.InvalidSubLabelPriorityException The priority 4 for sub-label is invalid and should be in the range for 5 - 6.

CategoryInfo : NotSpecified: (:) [Set-Label], InvalidSubLabelPriorityException FullyQualifiedErrorId : [TimeStamp=Mon, 23 Sep 2024 10:09:26 GMT],Write-ErrorMessage

It seems the numbering is messed up and the priority setting needs to be one more than what is listed. So using the graphic above to change the child priorities like this image

You would need to use Set-Label -Id $Label.Id -Priority 3 (to move child1 to child2 place) Set-Label -Id $Label.Id -Priority 6 (to move kid1 to kid2 place)

Surely this is a Powershell bug ?

Microsoft 365 DSC Version

V1.24.904.1

Which workloads are affected

Security & Compliance Center

The DSC configuration

No response

Verbose logs showing the problem

No response

Environment Information + PowerShell Version

No response

tayhall avatar Sep 23 '24 10:09 tayhall