Skip to content

Commit

Permalink
fix IntuneAntivirusPolicyWindows10SettingCatalog
Browse files Browse the repository at this point in the history
  • Loading branch information
William-Francillette committed Nov 27, 2023
1 parent 4a4380b commit 119b802
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

# UNRELEASED

* IntuneAntivirusPolicyWindows10SettingCatalog
* Skipped settingValueTemplateReference and settingInstanceTemplateReference for severethreats, highseveritythreats, moderateseveritythreats, lowseveritythreats as per API requirements observed in the Intune portal
FIXES [#3818](https://github.com/microsoft/Microsoft365DSC/issues/3818)
* DEPENDENCIES
* Updated Microsoft.Graph to version 2.10.0.
* Updated MSCloudLoginAssistant to version 1.1.0.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1590,7 +1590,7 @@ function New-IntuneDeviceConfigurationPolicy
'settings' = $Settings
}
$body = $policy | ConvertTo-Json -Depth 20
Write-Verbose -Message $body
#Write-Verbose -Message $body
Invoke-MgGraphRequest -Method POST -Uri $Uri -Body $body -ErrorAction Stop

}
Expand All @@ -1602,6 +1602,7 @@ function New-IntuneDeviceConfigurationPolicy
-TenantId $TenantId `
-Credential $Credential

#write-verbose ($_ | out-string)
return $null
}
}
Expand Down Expand Up @@ -1819,6 +1820,11 @@ function Format-M365DSCIntuneSettingCatalogPolicySettings
$setting.add('@odata.type', '#microsoft.graph.deviceManagementConfigurationSetting')

$includeValueReference = $true
$includeSettingInstanceReference = $true
$doNotIncludesettingInstanceReferenceKeys = @(
'highseveritythreats'
'lowseveritythreats'
)
$noValueReferenceKeys = @(
'excludedpaths'
'excludedprocesses'
Expand All @@ -1828,9 +1834,14 @@ function Format-M365DSCIntuneSettingCatalogPolicySettings
{
$includeValueReference = $false
}
if ($originalKey -in $doNotIncludesettingInstanceReferenceKeys)
{
$includeSettingInstanceReference = $false
}
$myFormattedSetting = Format-M365DSCParamsToSettingInstance -DSCParams @{$settingKey = $DSCParams."$originalKey" } `
-TemplateSetting $templateSetting `
-IncludeSettingValueTemplateId $includeValueReference
-IncludeSettingValueTemplateId $includeValueReference `
-IncludeSettingInstanceTemplateId $includeSettingInstanceReference

$setting.add('settingInstance', $myFormattedSetting)
$settings += $setting
Expand Down Expand Up @@ -1871,9 +1882,36 @@ function Format-M365DSCIntuneSettingCatalogPolicySettings
-FilterScript { $_.settingDefinitionId -like "*$key" }
if ($templateValue)
{
$includeValueReference = $true
$includeSettingInstanceReference = $true
$doNotIncludesettingInstanceReferenceKeys = @(
'highseveritythreats'
'lowseveritythreats'
'moderateseveritythreats'
'severethreats'
)
$noValueReferenceKeys = @(
'excludedpaths'
'excludedprocesses'
'excludedextensions'
'highseveritythreats'
'lowseveritythreats'
'moderateseveritythreats'
'severethreats'
)
if ($key -in $noValueReferenceKeys)
{
$includeValueReference = $false
}
if ($key -in $doNotIncludesettingInstanceReferenceKeys)
{
$includeSettingInstanceReference = $false
}
$groupSettingCollectionValueChild = Format-M365DSCParamsToSettingInstance `
-DSCParams @{$key = $DSCParams."$key" } `
-TemplateSetting $templateValue
-TemplateSetting $templateValue `
-IncludeSettingValueTemplateId $includeValueReference `
-IncludeSettingInstanceTemplateId $includeSettingInstanceReference

$groupSettingCollectionValueChildren += $groupSettingCollectionValueChild
}
Expand Down

0 comments on commit 119b802

Please sign in to comment.