From 616d2a1815005900663925f45e9c98976b388d23 Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Mon, 25 Nov 2024 16:07:14 -0500 Subject: [PATCH] Fixes #5430 --- CHANGELOG.md | 5 ++++- Modules/Microsoft365DSC/Modules/M365DSCDRGUtil.psm1 | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30dd94522b..a27150cfa3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,9 +16,12 @@ * Added logic to update an existing recipient's permissions. * EXOTransportRule * Changed how empty arrays are returned. - * IntuneAndroidManagedStoreAppConfiguration * Initial release. +* IntuneAppConfigurationPolicy + * Fixes an issue where assignment wasn't properly set if the + groupId was null. + FIXES [#5430](https://github.com/microsoft/Microsoft365DSC/issues/5430) * TeamsUserPolicyAssignment * Added support for the Global policies. * TeamsUpgradePolicy diff --git a/Modules/Microsoft365DSC/Modules/M365DSCDRGUtil.psm1 b/Modules/Microsoft365DSC/Modules/M365DSCDRGUtil.psm1 index 2ba46fb602..22f7ae49f8 100644 --- a/Modules/Microsoft365DSC/Modules/M365DSCDRGUtil.psm1 +++ b/Modules/Microsoft365DSC/Modules/M365DSCDRGUtil.psm1 @@ -982,7 +982,11 @@ function ConvertTo-IntunePolicyAssignment } elseif ($assignment.dataType -like '*GroupAssignmentTarget') { - $group = Get-MgGroup -GroupId ($assignment.groupId) -ErrorAction SilentlyContinue + $group = $null + if (-not [System.String]::IsNullOrEmpty($assignment.groupId)) + { + $group = Get-MgGroup -GroupId ($assignment.groupId) -ErrorAction SilentlyContinue + } if ($null -eq $group) { if ($assignment.groupDisplayName)