SCSensitivityLabels | Setting Label Priority
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
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
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