diff --git a/CHANGELOG.md b/CHANGELOG.md index 2887ff3a64..5b48049cdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ * Fixed bug where an empty value was passed in the request for the insiderRiskLevels parameter, which throws an error. FIXES [#5389](https://github.com/microsoft/Microsoft365DSC/issues/5389) +* EXOATPBuiltInProtectionRule, EXOEOPProtectionRule + * Fixed issue where empty arrays were being compared incorrectly to null + strings + FIXES [#5394](https://github.com/microsoft/Microsoft365DSC/issues/5394) * IntuneAccountProtectionLocalAdministratorPasswordSolutionPolicy * Update property `PasswordAgeDays_AAD` to be lower-case. FIXES [#5378](https://github.com/microsoft/Microsoft365DSC/issues/5378) (1/2) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOATPBuiltInProtectionRule/MSFT_EXOATPBuiltInProtectionRule.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOATPBuiltInProtectionRule/MSFT_EXOATPBuiltInProtectionRule.psm1 index 81087e37ee..8deb5252dc 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOATPBuiltInProtectionRule/MSFT_EXOATPBuiltInProtectionRule.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOATPBuiltInProtectionRule/MSFT_EXOATPBuiltInProtectionRule.psm1 @@ -249,6 +249,21 @@ function Test-TargetResource Write-Verbose -Message "Current Values: $(Convert-M365DscHashtableToString -Hashtable $CurrentValues)" Write-Verbose -Message "Target Values: $(Convert-M365DscHashtableToString -Hashtable $ValuesToCheck)" + foreach ($key in $ValuesToCheck.Keys) + { + if ($null -eq $CurrentValues[$key]) + { + switch -regex ($key) + { + "^ExceptIf\w+$" + { + $CurrentValues[$key] = @() + break + } + } + } + } + $testResult = Test-M365DSCParameterState -CurrentValues $CurrentValues ` -Source $($MyInvocation.MyCommand.Source) ` -DesiredValues $PSBoundParameters ` diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOEOPProtectionPolicyRule/MSFT_EXOEOPProtectionPolicyRule.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOEOPProtectionPolicyRule/MSFT_EXOEOPProtectionPolicyRule.psm1 index 2ae3854191..b2fd449dd0 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOEOPProtectionPolicyRule/MSFT_EXOEOPProtectionPolicyRule.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOEOPProtectionPolicyRule/MSFT_EXOEOPProtectionPolicyRule.psm1 @@ -374,13 +374,26 @@ function Test-TargetResource Write-Verbose -Message "Current Values: $(Convert-M365DscHashtableToString -Hashtable $CurrentValues)" Write-Verbose -Message "Target Values: $(Convert-M365DscHashtableToString -Hashtable $ValuesToCheck)" - #Convert any DateTime to String foreach ($key in $ValuesToCheck.Keys) { + # Convert any DateTime to String if (($null -ne $CurrentValues[$key]) ` -and ($CurrentValues[$key].GetType().Name -eq 'DateTime')) { $CurrentValues[$key] = $CurrentValues[$key].toString() + continue + } + + if ($null -eq $CurrentValues[$key]) + { + switch -regex ($key) + { + "^ExceptIf\w+$|^RecipientDomainIs$|^SentTo(\w+)?$" + { + $CurrentValues[$key] = @() + break + } + } } }