-
Notifications
You must be signed in to change notification settings - Fork 586
Fix: Always export AdvancedSettings as array in SCSensitivityLabel #6375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: Dev
Are you sure you want to change the base?
Fix: Always export AdvancedSettings as array in SCSensitivityLabel #6375
Conversation
@microsoft-github-policy-service agree |
@Harikmar4 The CIM instance conversion you're trying to fix is based on the actual value of the property. To not meddle with the CIM conversion at the end, it's more appropriate to ensure that the property is an array. To fix this, update the following line: # lines 361 to 363
if ($null -ne $label.Settings)
{
# Add the [array] type indicator to the variable to enforce conversion to an array
[array]$advancedSettingsValue = Convert-StringToAdvancedSettings -AdvancedSettings $label.Settings
} This way, the export will look correctly: SCSensitivityLabel "SCSensitivityLabel-defa4170-0d19-0005-0000-bc88714345d2"
{
AdvancedSettings = @(
MSFT_SCLabelSetting{
Key = "isparent"
Value = "False"
}
);
... This also reduces the PR size massively 😉 |
Thanks for the clarification.
This ensures that AdvancedSettings is always an array. Since $advancedSettingsValue is assigned directly in the export block ($result = @{} at line 642), a separate assignment like $Results.AdvancedSettings = $advancedSettingsValue isn’t necessary. |
LGTM, now we have to wait for approval and merge. Thank you for the fix 👍 |
@Harikumar4 Can you please update the issue link in the Pull Request description? The link is currently invalid. You can just type |
Pull Request (PR) description
This PR ensures that the
AdvancedSettings
property in theSCSensitivityLabel
resource is always exported as an array block in the generated DSC configuration, even when there is only a single item. This improves consistency and prevents downstream issues when consuming the exported configuration.This Pull Request (PR) fixes the following issues
Task list
CHANGELOG.md
.schema.mof
. (Not applicable for this PR)README.md
. (Not applicable for this PR)settings.json
file contains all required permissions. (Not applicable for this PR)