From adc3a160d1af526b5eb61ac946f6f3dd54783ef0 Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Mon, 25 Nov 2024 14:21:01 -0500 Subject: [PATCH] Various Fixes --- CHANGELOG.md | 6 +++++- .../MSFT_EXOMailContact/MSFT_EXOMailContact.psm1 | 4 ++++ .../DSCResources/MSFT_EXOPlace/MSFT_EXOPlace.psm1 | 8 +++++++- .../MSFT_EXOTransportRule/MSFT_EXOTransportRule.psm1 | 10 ++++++++++ Modules/Microsoft365DSC/Dependencies/Manifest.psd1 | 2 +- 5 files changed, 27 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d099f0905f..fe47039fbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ * AAD * Added ApplicationSecret auth method to multiple resources +* EXOMailContact + * Changed how empty arrays are returned. +* EXOPlace + * Changed how empty arrays are returned. * EXORecipientPermission * Added logic to update an existing recipient's permissions. * EXOEOPProtectionPolicyRule @@ -20,7 +24,7 @@ * MISC * Removed hardcoded Graph urls and replaced by MSCloudLoginAssistant values. * DEPENDENCIES - * Updated DSCParser to version 2.0.0.13. + * Updated DSCParser to version 2.0.0.14. * Updated Microsoft.Graph to version 2.25.0. * Updated Microsoft.PowerApps.Administration.PowerShell to version 2.0.200. * Updated MicrosoftTeams to version 6.7.0. diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMailContact/MSFT_EXOMailContact.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMailContact/MSFT_EXOMailContact.psm1 index 8553bf9155..cb39fd5900 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMailContact/MSFT_EXOMailContact.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMailContact/MSFT_EXOMailContact.psm1 @@ -268,6 +268,10 @@ function Get-TargetResource { $result."ExtensionCustomAttribute$i" = $contact."ExtensionCustomAttribute$i" } + else + { + $result."ExtensionCustomAttribute$i" = @() + } } Write-Verbose -Message "Found Mail Contact $($Name)" diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOPlace/MSFT_EXOPlace.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOPlace/MSFT_EXOPlace.psm1 index 227fc1f57e..9327331b4d 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOPlace/MSFT_EXOPlace.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOPlace/MSFT_EXOPlace.psm1 @@ -181,6 +181,12 @@ function Get-TargetResource } } + $TagsValue = [Array] $place.Tags + if ($place.Tags -eq $null) + { + $TagsValue = @() + } + $result = @{ Identity = $place.Identity AudioDeviceName = $place.AudioDeviceName @@ -203,7 +209,7 @@ function Get-TargetResource PostalCode = $place.PostalCode State = $place.State Street = $place.Street - Tags = [Array] $place.Tags + Tags = $TagsValue VideoDeviceName = $place.VideoDeviceName Credential = $Credential Ensure = 'Present' diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOTransportRule/MSFT_EXOTransportRule.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOTransportRule/MSFT_EXOTransportRule.psm1 index 0cea524e88..89055e9a3f 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOTransportRule/MSFT_EXOTransportRule.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOTransportRule/MSFT_EXOTransportRule.psm1 @@ -967,6 +967,16 @@ function Get-TargetResource TenantId = $TenantId AccessTokens = $AccessTokens } + $inputParams = (Get-Command 'Get-TargetResource').Parameters + foreach ($key in $inputParams.Keys) + { + $propertyInfo = $inputParams.$key + $curVar = Get-Variable -Name $key -ErrorAction SilentlyContinue + if ($propertyInfo.ParameterType.Name -eq 'String[]' -and $curVar -ne $null -and $curVar.Value -eq $null) + { + $result.$key = @() + } + } # Formats DateTime as String if ($null -ne $result.ActivationDate) diff --git a/Modules/Microsoft365DSC/Dependencies/Manifest.psd1 b/Modules/Microsoft365DSC/Dependencies/Manifest.psd1 index 39db52ebef..e04173694f 100644 --- a/Modules/Microsoft365DSC/Dependencies/Manifest.psd1 +++ b/Modules/Microsoft365DSC/Dependencies/Manifest.psd1 @@ -18,7 +18,7 @@ }, @{ ModuleName = 'DSCParser' - RequiredVersion = '2.0.0.13' + RequiredVersion = '2.0.0.14' }, @{ ModuleName = 'ExchangeOnlineManagement'