From 31e8c0a2d02c634a4c2ae5e30bc19bb1a59ebdf7 Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Fri, 16 Jun 2023 07:56:31 -0400 Subject: [PATCH 1/2] Update MSFT_SCLabelPolicy.psm1 --- .../MSFT_SCLabelPolicy/MSFT_SCLabelPolicy.psm1 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCLabelPolicy/MSFT_SCLabelPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCLabelPolicy/MSFT_SCLabelPolicy.psm1 index 56d428c0cb..d994b4f7f9 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCLabelPolicy/MSFT_SCLabelPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCLabelPolicy/MSFT_SCLabelPolicy.psm1 @@ -985,7 +985,14 @@ function Convert-CIMToAdvancedSettings if ($obj.Value -ne 'None') { $label = Get-Label | Where-Object -FilterScript { $_.DisplayName -eq $obj.Value } - $settingsValues = $label.ImmutableId.ToString() + if ($null -eq $label) + { + Write-Error -Message "Label {$($obj.value)} doesn't exist. Please define the Sensitivy label first before trying to assign it to a policy." + } + else + { + $settingsValues = $label.ImmutableId.ToString() + } } else { From 053ecf09dda979de4d3e2951505a71b98b8aab90 Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Fri, 16 Jun 2023 13:47:32 -0400 Subject: [PATCH 2/2] Fixes #3224 --- CHANGELOG.md | 6 ++++++ .../MSFT_SCProtectionAlert/MSFT_SCProtectionAlert.psm1 | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e11ff6a006..933fb4e71e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change log for Microsoft365DSC +# UNRELEASED + +* SCProtectionAlert + * Prevents extracting system rules. + FIXES [#3224](https://github.com/microsoft/Microsoft365DSC/issues/3224) + # 1.23.614.1 * AADApplication diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SCProtectionAlert/MSFT_SCProtectionAlert.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SCProtectionAlert/MSFT_SCProtectionAlert.psm1 index 583d151ea1..c2728a4451 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SCProtectionAlert/MSFT_SCProtectionAlert.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SCProtectionAlert/MSFT_SCProtectionAlert.psm1 @@ -640,7 +640,7 @@ function Export-TargetResource try { - [array]$Alerts = Get-ProtectionAlert -ErrorAction Stop + [array]$Alerts = Get-ProtectionAlert -ErrorAction Stop | Where-Object -FilterScript {-not $_.IsSystemRule} $totalAlerts = $Alerts.Length if ($null -eq $totalAlerts)