From b97ee2e556b5aec6c1a4743566fbf67055b3c284 Mon Sep 17 00:00:00 2001 From: tayhall <51701340+tayhall@users.noreply.github.com> Date: Wed, 21 Aug 2024 14:21:38 +0100 Subject: [PATCH 1/3] Update MSFT_EXORoleGroup.psm1 Updated to handle $null on compare-object and also allows the adding of members to the Role with empty members --- .../MSFT_EXORoleGroup/MSFT_EXORoleGroup.psm1 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXORoleGroup/MSFT_EXORoleGroup.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXORoleGroup/MSFT_EXORoleGroup.psm1 index 44f102c318..ddaf63e526 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXORoleGroup/MSFT_EXORoleGroup.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXORoleGroup/MSFT_EXORoleGroup.psm1 @@ -240,7 +240,14 @@ function Set-TargetResource Remove-RoleGroup -Identity $Name -Confirm:$false -Force } # CASE: Role Group exists and it should, but has different member values than the desired ones - elseif ($Ensure -eq 'Present' -and $currentRoleGroupConfig.Ensure -eq 'Present' -and $null -ne (Compare-Object -ReferenceObject $($currentRoleGroupConfig.Members) -DifferenceObject $Members)) + elseif ($Ensure -eq 'Present' -and $currentRoleGroupConfig.Ensure -eq 'Present' -and $null -ne (Compare-Object -ReferenceObject @($($currentRoleGroupConfig.Members) | Select-Object) -DifferenceObject @($Members | Select-Object))) + { + Write-Verbose -Message "Role Group '$($Name)' already exists, but members need updating." + Write-Verbose -Message "Updating Role Group $($Name) members with values: $(Convert-M365DscHashtableToString -Hashtable $NewRoleGroupParams)" + Update-RoleGroupMember -Identity $Name -Members $Members -Confirm:$false + } + # CASE: Role Assignment Policy exists and it should, but Role has no members as its never been set + elseif ($Ensure -eq 'Present' -and $currentRoleGroupConfig.Ensure -eq 'Present' -and $currentRoleGroupConfig.Members -eq '') { Write-Verbose -Message "Role Group '$($Name)' already exists, but members need updating." Write-Verbose -Message "Updating Role Group $($Name) members with values: $(Convert-M365DscHashtableToString -Hashtable $NewRoleGroupParams)" From 37a844e77e2708060c15d1a1d6fddb92f623d89b Mon Sep 17 00:00:00 2001 From: tayhall <51701340+tayhall@users.noreply.github.com> Date: Fri, 23 Aug 2024 11:53:56 +0100 Subject: [PATCH 2/3] Update CHANGELOG.md Added details of fix and related issue --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 116d97723f..189cf37dcd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ # UNRELEASED +* EXORoleGroup + * Fix an issue where roles that have empty members cannot be compared + FIXES [#4977] (https://github.com/microsoft/Microsoft365DSC/issues/4977) * AADConditionalAccessPolicy * Fixing issue where the resource crashed when trying to retrieve groups and users from Entra ID which no longer existed From a9829fa5870183d15ac734ff7bbaef44cabf0554 Mon Sep 17 00:00:00 2001 From: tayhall <51701340+tayhall@users.noreply.github.com> Date: Fri, 23 Aug 2024 12:02:03 +0100 Subject: [PATCH 3/3] Update CHANGELOG.md Alphabetical update --- CHANGELOG.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 189cf37dcd..ba99742b21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,7 @@ # UNRELEASED -* EXORoleGroup - * Fix an issue where roles that have empty members cannot be compared - FIXES [#4977] (https://github.com/microsoft/Microsoft365DSC/issues/4977) + * AADConditionalAccessPolicy * Fixing issue where the resource crashed when trying to retrieve groups and users from Entra ID which no longer existed @@ -20,6 +18,9 @@ * EXOHostedContentFilterRule * Don't check if associated `EXOHostedContentFilterPolicy` is present while removing resource since it's not required + * EXORoleGroup + * Fix an issue where roles that have empty members cannot be compared + FIXES [#4977] (https://github.com/microsoft/Microsoft365DSC/issues/4977) * IntuneAccountProtectionLocalAdministratorPasswordSolutionPolicy * Fixed issue if `PasswordComplexity` was set to 5 by allowing that value FIXES [#4963](https://github.com/microsoft/Microsoft365DSC/issues/4963)