From 6fe7385d1b05f517d0720c948a5dc2115d371b35 Mon Sep 17 00:00:00 2001 From: Fabien Tschanz Date: Fri, 8 Nov 2024 22:03:26 +0100 Subject: [PATCH] Switch log type to Warning for not found Intune assignments --- CHANGELOG.md | 2 ++ .../Modules/M365DSCDRGUtil.psm1 | 24 +++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 202464f1d7..33c1b15421 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ * Initial release. * IntuneAntivirusExclusionsPolicyLinux * Initial release. +* M365DSCDRGUtil + * Switch log type for not found Intune assignments to `Warning`. * MISC * Fixed issues with API Url's parsing. diff --git a/Modules/Microsoft365DSC/Modules/M365DSCDRGUtil.psm1 b/Modules/Microsoft365DSC/Modules/M365DSCDRGUtil.psm1 index c6ac727450..072d8bcfb3 100644 --- a/Modules/Microsoft365DSC/Modules/M365DSCDRGUtil.psm1 +++ b/Modules/Microsoft365DSC/Modules/M365DSCDRGUtil.psm1 @@ -992,14 +992,14 @@ function ConvertTo-IntunePolicyAssignment { $message = "Skipping assignment for the group with DisplayName {$($assignment.groupDisplayName)} as it could not be found in the directory.`r`n" $message += "Please update your DSC resource extract with the correct groupId or groupDisplayName." - Write-Verbose -Message $message + Write-Warning -Message $message $target = $null } if ($group -and $group.Count -gt 1) { $message = "Skipping assignment for the group with DisplayName {$($assignment.groupDisplayName)} as it is not unique in the directory.`r`n" $message += "Please update your DSC resource extract with the correct groupId or a unique group DisplayName." - Write-Verbose -Message $message + Write-Warning -Message $message $group = $null $target = $null } @@ -1008,7 +1008,7 @@ function ConvertTo-IntunePolicyAssignment { $message = "Skipping assignment for the group with Id {$($assignment.groupId)} as it could not be found in the directory.`r`n" $message += "Please update your DSC resource extract with the correct groupId or a unique group DisplayName." - Write-Verbose -Message $message + Write-Warning -Message $message $target = $null } } @@ -1165,14 +1165,14 @@ function ConvertTo-IntuneMobileAppAssignment { $message = "Skipping assignment for the group with DisplayName {$($assignment.groupDisplayName)} as it could not be found in the directory.`r`n" $message += "Please update your DSC resource extract with the correct groupId or groupDisplayName." - Write-Verbose -Message $message + Write-Warning -Message $message $target = $null } if ($group -and $group.Count -gt 1) { $message = "Skipping assignment for the group with DisplayName {$($assignment.groupDisplayName)} as it is not unique in the directory.`r`n" $message += "Please update your DSC resource extract with the correct groupId or a unique group DisplayName." - Write-Verbose -Message $message + Write-Warning -Message $message $group = $null $target = $null } @@ -1181,7 +1181,7 @@ function ConvertTo-IntuneMobileAppAssignment { $message = "Skipping assignment for the group with Id {$($assignment.groupId)} as it could not be found in the directory.`r`n" $message += "Please update your DSC resource extract with the correct groupId or a unique group DisplayName." - Write-Verbose -Message $message + Write-Warning -Message $message $target = $null } } @@ -1329,14 +1329,14 @@ function Update-DeviceConfigurationPolicyAssignment { $message = "Skipping assignment for the group with DisplayName {$($target.groupDisplayName)} as it could not be found in the directory.`r`n" $message += "Please update your DSC resource extract with the correct groupId or groupDisplayName." - Write-Verbose -Message $message + Write-Warning -Message $message $target = $null } if ($group -and $group.count -gt 1) { $message = "Skipping assignment for the group with DisplayName {$($target.groupDisplayName)} as it is not unique in the directory.`r`n" $message += "Please update your DSC resource extract with the correct groupId or a unique group DisplayName." - Write-Verbose -Message $message + Write-Warning -Message $message $group = $null $target = $null } @@ -1345,7 +1345,7 @@ function Update-DeviceConfigurationPolicyAssignment { $message = "Skipping assignment for the group with Id {$($target.groupId)} as it could not be found in the directory.`r`n" $message += "Please update your DSC resource extract with the correct groupId or a unique group DisplayName." - Write-Verbose -Message $message + Write-Warning -Message $message $target = $null } } @@ -1452,14 +1452,14 @@ function Update-DeviceAppManagementPolicyAssignment { $message = "Skipping assignment for the group with DisplayName {$($target.groupDisplayName)} as it could not be found in the directory.`r`n" $message += "Please update your DSC resource extract with the correct groupId or groupDisplayName." - Write-Verbose -Message $message + Write-Warning -Message $message $target = $null } if ($group -and $group.count -gt 1) { $message = "Skipping assignment for the group with DisplayName {$($target.groupDisplayName)} as it is not unique in the directory.`r`n" $message += "Please update your DSC resource extract with the correct groupId or a unique group DisplayName." - Write-Verbose -Message $message + Write-Warning -Message $message $group = $null $target = $null } @@ -1468,7 +1468,7 @@ function Update-DeviceAppManagementPolicyAssignment { $message = "Skipping assignment for the group with Id {$($target.groupId)} as it could not be found in the directory.`r`n" $message += "Please update your DSC resource extract with the correct groupId or a unique group DisplayName." - Write-Verbose -Message $message + Write-Warning -Message $message $target = $null } }