From cc0690bb4a8567e92c269387aeee994e0fefeb72 Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Fri, 18 Nov 2022 12:43:24 -0500 Subject: [PATCH 1/2] Update MSFT_EXOAddressList.psm1 --- .../MSFT_EXOAddressList.psm1 | 154 +++++++++--------- 1 file changed, 76 insertions(+), 78 deletions(-) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAddressList/MSFT_EXOAddressList.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAddressList/MSFT_EXOAddressList.psm1 index eba21a70ad..af97fd37a0 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAddressList/MSFT_EXOAddressList.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAddressList/MSFT_EXOAddressList.psm1 @@ -401,88 +401,47 @@ function Set-TargetResource Add-M365DSCTelemetryEvent -Data $data #endregion - - if ($RecipientFilter) - { - Write-Verbose -Message "You can't use RecipientFilter and precanned filters at the same time. All precanned filters will be ignored." - $NewAddressListParams = @{ - Name = $Name - RecipientFilter = $RecipientFilter - Confirm = $false - } - } - else - { - $NewAddressListParams = @{ - Name = $Name - ConditionalCompany = $ConditionalCompany - ConditionalCustomAttribute1 = $ConditionalCustomAttribute1 - ConditionalCustomAttribute10 = $ConditionalCustomAttribute10 - ConditionalCustomAttribute11 = $ConditionalCustomAttribute11 - ConditionalCustomAttribute12 = $ConditionalCustomAttribute12 - ConditionalCustomAttribute13 = $ConditionalCustomAttribute13 - ConditionalCustomAttribute14 = $ConditionalCustomAttribute14 - ConditionalCustomAttribute15 = $ConditionalCustomAttribute15 - ConditionalCustomAttribute2 = $ConditionalCustomAttribute2 - ConditionalCustomAttribute3 = $ConditionalCustomAttribute3 - ConditionalCustomAttribute4 = $ConditionalCustomAttribute4 - ConditionalCustomAttribute5 = $ConditionalCustomAttribute5 - ConditionalCustomAttribute6 = $ConditionalCustomAttribute6 - ConditionalCustomAttribute7 = $ConditionalCustomAttribute7 - ConditionalCustomAttribute8 = $ConditionalCustomAttribute8 - ConditionalCustomAttribute9 = $ConditionalCustomAttribute9 - ConditionalDepartment = $ConditionalDepartment - ConditionalStateOrProvince = $ConditionalStateOrProvince - DisplayName = $DisplayName - IncludedRecipients = $IncludedRecipients - Confirm = $false - } - } - - if ($RecipientFilter) - { - Write-Verbose -Message "You can't use RecipientFilter and precanned filters at the same time. All precanned filters will be ignored." - $SetAddressListParams = @{ - Identity = $Name - Name = $Name - RecipientFilter = $RecipientFilter - Confirm = $false - } - } - else - { - $SetAddressListParams = @{ - Identity = $Name - Name = $Name - ConditionalCompany = $ConditionalCompany - ConditionalCustomAttribute1 = $ConditionalCustomAttribute1 - ConditionalCustomAttribute10 = $ConditionalCustomAttribute10 - ConditionalCustomAttribute11 = $ConditionalCustomAttribute11 - ConditionalCustomAttribute12 = $ConditionalCustomAttribute12 - ConditionalCustomAttribute13 = $ConditionalCustomAttribute13 - ConditionalCustomAttribute14 = $ConditionalCustomAttribute14 - ConditionalCustomAttribute15 = $ConditionalCustomAttribute15 - ConditionalCustomAttribute2 = $ConditionalCustomAttribute2 - ConditionalCustomAttribute3 = $ConditionalCustomAttribute3 - ConditionalCustomAttribute4 = $ConditionalCustomAttribute4 - ConditionalCustomAttribute5 = $ConditionalCustomAttribute5 - ConditionalCustomAttribute6 = $ConditionalCustomAttribute6 - ConditionalCustomAttribute7 = $ConditionalCustomAttribute7 - ConditionalCustomAttribute8 = $ConditionalCustomAttribute8 - ConditionalCustomAttribute9 = $ConditionalCustomAttribute9 - ConditionalDepartment = $ConditionalDepartment - ConditionalStateOrProvince = $ConditionalStateOrProvince - DisplayName = $DisplayName - IncludedRecipients = $IncludedRecipients - RecipientFilter = $RecipientFilter - Confirm = $false - } - } - #Address List doesn't exist but it should if ($Ensure -eq 'Present' -and $currentAddressListConfig.Ensure -eq 'Absent') { Write-Verbose -Message "The Address List '$($Name)' does not exist but it should. Creating Address List." + + if ($RecipientFilter) + { + Write-Verbose -Message "You can't use RecipientFilter and precanned filters at the same time. All precanned filters will be ignored." + $NewAddressListParams = @{ + Name = $Name + RecipientFilter = $RecipientFilter + Confirm = $false + } + } + else + { + $NewAddressListParams = @{ + Name = $Name + ConditionalCompany = $ConditionalCompany + ConditionalCustomAttribute1 = $ConditionalCustomAttribute1 + ConditionalCustomAttribute10 = $ConditionalCustomAttribute10 + ConditionalCustomAttribute11 = $ConditionalCustomAttribute11 + ConditionalCustomAttribute12 = $ConditionalCustomAttribute12 + ConditionalCustomAttribute13 = $ConditionalCustomAttribute13 + ConditionalCustomAttribute14 = $ConditionalCustomAttribute14 + ConditionalCustomAttribute15 = $ConditionalCustomAttribute15 + ConditionalCustomAttribute2 = $ConditionalCustomAttribute2 + ConditionalCustomAttribute3 = $ConditionalCustomAttribute3 + ConditionalCustomAttribute4 = $ConditionalCustomAttribute4 + ConditionalCustomAttribute5 = $ConditionalCustomAttribute5 + ConditionalCustomAttribute6 = $ConditionalCustomAttribute6 + ConditionalCustomAttribute7 = $ConditionalCustomAttribute7 + ConditionalCustomAttribute8 = $ConditionalCustomAttribute8 + ConditionalCustomAttribute9 = $ConditionalCustomAttribute9 + ConditionalDepartment = $ConditionalDepartment + ConditionalStateOrProvince = $ConditionalStateOrProvince + DisplayName = $DisplayName + IncludedRecipients = $IncludedRecipients + Confirm = $false + } + } New-AddressList @NewAddressListParams } #Address List exists but shouldn't @@ -494,6 +453,45 @@ function Set-TargetResource elseif ($Ensure -eq 'Present' -and $currentAddressListConfig.Ensure -eq 'Present') { Write-Verbose -Message "Address List '$($Name)' already exists. Updating settings" + if ($RecipientFilter) + { + Write-Verbose -Message "You can't use RecipientFilter and precanned filters at the same time. All precanned filters will be ignored." + $SetAddressListParams = @{ + Identity = $Name + Name = $Name + RecipientFilter = $RecipientFilter + Confirm = $false + } + } + else + { + $SetAddressListParams = @{ + Identity = $Name + Name = $Name + ConditionalCompany = $ConditionalCompany + ConditionalCustomAttribute1 = $ConditionalCustomAttribute1 + ConditionalCustomAttribute10 = $ConditionalCustomAttribute10 + ConditionalCustomAttribute11 = $ConditionalCustomAttribute11 + ConditionalCustomAttribute12 = $ConditionalCustomAttribute12 + ConditionalCustomAttribute13 = $ConditionalCustomAttribute13 + ConditionalCustomAttribute14 = $ConditionalCustomAttribute14 + ConditionalCustomAttribute15 = $ConditionalCustomAttribute15 + ConditionalCustomAttribute2 = $ConditionalCustomAttribute2 + ConditionalCustomAttribute3 = $ConditionalCustomAttribute3 + ConditionalCustomAttribute4 = $ConditionalCustomAttribute4 + ConditionalCustomAttribute5 = $ConditionalCustomAttribute5 + ConditionalCustomAttribute6 = $ConditionalCustomAttribute6 + ConditionalCustomAttribute7 = $ConditionalCustomAttribute7 + ConditionalCustomAttribute8 = $ConditionalCustomAttribute8 + ConditionalCustomAttribute9 = $ConditionalCustomAttribute9 + ConditionalDepartment = $ConditionalDepartment + ConditionalStateOrProvince = $ConditionalStateOrProvince + DisplayName = $DisplayName + IncludedRecipients = $IncludedRecipients + RecipientFilter = $RecipientFilter + Confirm = $false + } + } Write-Verbose -Message "Setting Address List '$($Name)' with values: $(Convert-M365DscHashtableToString -Hashtable $SetAddressListParams)" Set-AddressList @SetAddressListParams } From c7dd7554f7de2eecacf56c118f1322ae0cb35d0c Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Fri, 18 Nov 2022 15:53:20 -0500 Subject: [PATCH 2/2] Fixes #2517 --- CHANGELOG.md | 6 ++++++ .../DSCResources/MSFT_O365AdminAuditLogConfig/settings.json | 6 ++++++ .../MSFT_O365OrgCustomizationSetting/settings.json | 6 ++++++ Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1 | 6 +++++- 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79f917c258..0a56d55589 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ # UNRELEASED +* O365AdminAuditLogConfig + * Updated settings.json to include permissions. + FIXES [#2517](https://github.com/microsoft/Microsoft365DSC/issues/2517) +* O365OrgCustomizationSetting + * Updated settings.json to include permissions. + FIXES [#2517](https://github.com/microsoft/Microsoft365DSC/issues/2517) * SCRetentionCompliancePolicy * Fixes issue with the TeamsChannelLocation and TeamsChatsLocation parameters that were improperly returned by the Get- function. FIXES [#2472](https://github.com/microsoft/Microsoft365DSC/issues/2472) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_O365AdminAuditLogConfig/settings.json b/Modules/Microsoft365DSC/DSCResources/MSFT_O365AdminAuditLogConfig/settings.json index dd3289e9c2..c486e33c65 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_O365AdminAuditLogConfig/settings.json +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_O365AdminAuditLogConfig/settings.json @@ -11,6 +11,12 @@ "read": [], "update": [] } + }, + "exchange": { + "requiredroles": [ + "Audit Logs" + ], + "requiredrolegroups": [] } } } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_O365OrgCustomizationSetting/settings.json b/Modules/Microsoft365DSC/DSCResources/MSFT_O365OrgCustomizationSetting/settings.json index edf1bb7728..33a2f5587d 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_O365OrgCustomizationSetting/settings.json +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_O365OrgCustomizationSetting/settings.json @@ -11,6 +11,12 @@ "read": [], "update": [] } + }, + "exchange": { + "requiredroles": [ + "Organization Configuration" + ], + "requiredrolegroups": [] } } } diff --git a/Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1 b/Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1 index 55bd5a86d3..b6ed8ec461 100644 --- a/Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1 +++ b/Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1 @@ -3243,10 +3243,14 @@ function Get-M365DSCWorkloadsListFromResourceNames } 'O3' { - if (-not $workloads.Contains('MicrosoftGraph')) + if (-not $workloads.Contains('MicrosoftGraph') -and $resource -eq 'O365Group') { $workloads += 'MicrosoftGraph' } + elseif(-not $workloads.Contains('ExchangeOnline')) + { + $workloads += 'ExchangeOnline' + } } 'OD' {