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

Add exact match parameter to avoid invalid multiple results #3737

Merged

Conversation

pkernevez
Copy link
Contributor

@pkernevez pkernevez commented Oct 3, 2023

Pull Request (PR) description

Export may found multiple values for CsGroup.DisplayName and CSGroup.GroupId, then creates invalid export

This Pull Request (PR) fixes the following issues

Fixes #3736

@@ -365,7 +365,7 @@ function Export-TargetResource
$totalCount = $instances.Length
foreach ($item in $instances)
{
$Group = Find-CsGroup -SearchQuery $item.GroupId
$Group = Find-CsGroup -SearchQuery $item.GroupId -ExactMatchOnly $true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am trying to understand what the outcome would be here. If we have two instances with the same name, we should print a warning letting the user know we won't be exporting them like we do for other resource (e.g., AADApplication) instead of trying to determine which ones to export or skip.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I update the PR to support this case.

Now we are using the original groupId (unique) and and use the first display name (are they are all exactly equals).
I think we don't need any warning with this behaviour.

WDYT ?

@pkernevez pkernevez force-pushed the bugfix-may-found-multiple-value branch 3 times, most recently from 4917c96 to 5914d7e Compare October 6, 2023 15:51
Copy link
Collaborator

@andikrueger andikrueger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few minor remarks

@pkernevez pkernevez force-pushed the bugfix-may-found-multiple-value branch from c80dc30 to 699f1c5 Compare October 13, 2023 15:16
@NikCharlebois NikCharlebois merged commit 28d8973 into microsoft:Dev Oct 17, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export may found multiple values for CsGroup.DisplayName and CSGroup.GroupId, then creates invalid export
3 participants