Skip to content
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

SCSensitivityLabel - DisplayName can be duplicated which causes issues in Delta reports #2008

Closed
rayakajamon opened this issue Jun 13, 2022 · 11 comments · Fixed by #2402 or #2421
Closed
Labels
Enhancement New feature or request Intune

Comments

@rayakajamon
Copy link

No description provided.

@andikrueger andikrueger added Bug Something isn't working Intune labels Jun 14, 2022
@andikrueger
Copy link
Collaborator

Could you provide some additional information to this issue?

@rayakajamon
Copy link
Author

rayakajamon commented Jun 14, 2022 via email

@andikrueger
Copy link
Collaborator

Thanks a lot. This is a good examples and shows a further challenge we do have with exports.

There are various resources that use the (display) name as key parameter. I raised another issue #2006 that mentions this behavior.

@rayakajamon
Copy link
Author

rayakajamon commented Jun 14, 2022 via email

@NikCharlebois
Copy link
Collaborator

@rayakajamon can you provide additional information on how to replicate the scenario? We are unable to create two labels at the same hierarchy level with the same name. Thanks
image

@rayakajamon
Copy link
Author

rayakajamon commented Aug 9, 2022 via email

@andikrueger
Copy link
Collaborator

class MSFT_SCSensitivityLabel : OMI_BaseResource
{
[Key, Description("The Name parameter specifies the unique name for the sensitivity label. The maximum length is 64 characters. If the value contains spaces, enclose the value in quotation marks.")] String Name;
[Write, Description("Specify if this rule should exist or not."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;

This resource does only define one key parameter. This key needs to be unique. As you pointed out, the label name can be reused at different levels. these levels are handled, but are not part of the set key parameters.

Adding the ParentId as a secondary key could solve this problem, but would raise another issue on how to add a top level label, as $nullor an empty string would not be a valid value for this key.

[Write, Description("The ParentId parameter specifies the parent label that you want this label to be under (a sublabel). You can use any value that uniquely identifies the parent sensitivity label for example name.")] String ParentId;

Using the Id of the label is no option either, as we do not know this Id during creation time. (see: #2006)

@andikrueger andikrueger added Enhancement New feature or request and removed Bug Something isn't working Pending Information labels Oct 12, 2022
@NikCharlebois
Copy link
Collaborator

Still, I don't know how to reproduce this scenario. Trying to replicate your scenario, I get the following error when using the same name/display name for two sub-labels with a different parent id:
image

Just giving it a different displayname doesn't work, the Name property is the key. So I append a '2' at the end of the Name portion and it gets created. Doing that, I end up with the following:
image

Through PowerShell, here is what I am getting:
image

The Get-TargetResource uses the Name property and not the DisplayName, therefore this ensures we don't ever have a naming conflict even for sub-labels

@NikCharlebois
Copy link
Collaborator

I am however able to reproduce the issue with Delta report. It's as if the function thinks DisplayName is the primary key. Stay tuned

@NikCharlebois
Copy link
Collaborator

Problem comes from here: https://github.com/microsoft/Microsoft365DSC/blob/Dev/Modules/Microsoft365DSC/Modules/M365DSCReport.psm1#L691

Will be looking at making this more dynamic

NikCharlebois added a commit to NikCharlebois/Microsoft365DSC that referenced this issue Oct 14, 2022
@NikCharlebois
Copy link
Collaborator

Will also work on adding support for ParentId as a separate PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Intune
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants