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
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
was deleted.
* AADConditionalAccessPolicy
* Added support for the SigninFrequencyInterval parameter.
* TeamsGroupPolicyAssignment
* Fixes the export of CsGroup, when the display name of a group is included in another display name.
Fix [#3736](https://github.com/microsoft/Microsoft365DSC/issues/3736)

# 1.23.1011.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,15 +365,25 @@ function Export-TargetResource
$totalCount = $instances.Length
foreach ($item in $instances)
{
$Group = Find-CsGroup -SearchQuery $item.GroupId
[array]$Group = Find-CsGroup -SearchQuery $item.GroupId -ExactMatchOnly $true
if ($null -eq $totalCount)
{
$totalCount = 1
}
Write-Host " |---[$j/$totalCount] GroupPolicyAssignment {$($Group.DisplayName)}" -NoNewline
if ($totalCount -Eq 0)
{
$Message = "GPA The CSsGroup with ID {$($item.GroupId)} could not be found"
New-M365DSCLogEntry -Message $Message `
-Source $MyInvocation.MyCommand.ModuleName
Write-Error $Message
$groupDisplayName = ""
} else {
$groupDisplayName = $Group[0].DisplayName
}
Write-Host " |---[$j/$totalCount] GroupPolicyAssignment {$($Group[0].DisplayName)}" -NoNewline
$results = @{
GroupDisplayName = $Group.DisplayName
NikCharlebois marked this conversation as resolved.
Show resolved Hide resolved
GroupId = $Group.Id
GroupDisplayName = $groupDisplayName
GroupId = $item.GroupId
PolicyType = $item.PolicyType
PolicyName = $item.PolicyName
Priority = $item.Priority
Expand Down