From 8ee53106f2d745cace5d42affc49f4ea73023a66 Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Fri, 16 Dec 2022 15:06:10 -0500 Subject: [PATCH] Fixes #2587 --- CHANGELOG.md | 3 +++ .../DSCResources/MSFT_AADGroup/MSFT_AADGroup.psm1 | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d70c3a669a..0c97bc7c79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ # UNRELEASED +*AADGroup + * Extraction not longer exports Distribution List or mail enabled security list since these are not supported by the Microsoft Graph API. + FIXES [#2587](https://github.com/microsoft/Microsoft365DSC/issues/2587) * EXOMailContact * Ensures all results are returned from the Export scenario. Currently limited at 1,000 results. FIXES [#2672](https://github.com/microsoft/Microsoft365DSC/issues/2672) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADGroup/MSFT_AADGroup.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_AADGroup/MSFT_AADGroup.psm1 index bd758088f0..b185ff2efe 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADGroup/MSFT_AADGroup.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADGroup/MSFT_AADGroup.psm1 @@ -649,7 +649,7 @@ function Set-TargetResource } } } - else + elseif ($MembershipRuleProcessingState -ne 'On') { Write-Verbose -Message 'Ignoring membership since this is a dynamic group.' } @@ -1016,6 +1016,8 @@ function Export-TargetResource try { [array] $groups = Get-MgGroup -Filter $Filter -All:$true -ErrorAction Stop + $groups = $groups | Where-Object -FilterScript {-not ($_.MailEnabled -and ($null -eq $_.GroupTypes -or $_.GroupTypes.Length -eq 0)) -and + -not ($_.MailEnabled -and $_.SecurityEnabled)} $i = 1 $dscContent = '' Write-Host "`r`n" -NoNewline