Skip to content

Commit

Permalink
Merge pull request #5518 from FabienTschanz/fix/firewall-policy-export
Browse files Browse the repository at this point in the history
Fix export of Firewall policy settings
  • Loading branch information
NikCharlebois authored Dec 5, 2024
2 parents 7f8e981 + c1cd37d commit fbfbf20
Show file tree
Hide file tree
Showing 3 changed files with 155 additions and 1 deletion.
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

* IntuneFirewallPolicyWindows10
* Fix export of properties that appear multiple times in subsections.

# 1.24.1204.1

* All resources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -492,12 +492,19 @@ function Get-TargetResource

# Retrieve policy specific settings
[array]$settings = Get-MgBetaDeviceManagementConfigurationPolicySetting `
-All `
-DeviceManagementConfigurationPolicyId $Id `
-ExpandProperty 'settingDefinitions' `
-ErrorAction Stop
$policyTemplateId = $getValue.TemplateReference.TemplateId
[array]$settingDefinitions = Get-MgBetaDeviceManagementConfigurationPolicyTemplateSettingTemplate `
-DeviceManagementConfigurationPolicyTemplateId $policyTemplateId `
-ExpandProperty 'settingDefinitions' `
-All `
-ErrorAction Stop | Select-Object -ExpandProperty SettingDefinitions

$policySettings = @{}
$policySettings = Export-IntuneSettingCatalogPolicySettings -Settings $settings -ReturnHashtable $policySettings
$policySettings = Export-IntuneSettingCatalogPolicySettings -Settings $settings -ReturnHashtable $policySettings -AllSettingDefinitions $settingDefinitions

$results = @{
#region resource generator code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,150 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
)
}

Mock -CommandName Get-MgBetaDeviceManagementConfigurationPolicyTemplateSettingTemplate -MockWith {
return @(
@{
SettingDefinitions = @(
@{
Id = 'vendor_msft_firewall_mdmstore_global_disablestatefulftp'
Name = 'DisableStatefulFtp'
OffsetUri = '/MdmStore/Global/DisableStatefulFtp'
AdditionalProperties = @{
'@odata.type' = '#microsoft.graph.deviceManagementConfigurationChoiceSettingDefinition'
}
}
)
},
@{
SettingDefinitions = @(
@{
Id = 'vendor_msft_firewall_mdmstore_domainprofile_enablefirewall'
Name = 'EnableFirewall'
OffsetUri = '/MdmStore/DomainProfile/EnableFirewall'
AdditionalProperties = @{
'@odata.type' = '#microsoft.graph.deviceManagementConfigurationChoiceSettingDefinition'
}
},
@{
Id = 'vendor_msft_firewall_mdmstore_domainprofile_logfilepath'
Name = 'LogFilePath'
OffsetUri = '/MdmStore/DomainProfile/LogFilePath'
AdditionalProperties = @{
'@odata.type' = '#microsoft.graph.deviceManagementConfigurationStringSettingDefinition'
dependentOn = @(
@{
dependentOn = 'vendor_msft_firewall_mdmstore_domainprofile_enablefirewall_true'
parentSettingId = 'vendor_msft_firewall_mdmstore_domainprofile_enablefirewall'
}
)
}
},
@{
Id = 'vendor_msft_firewall_mdmstore_publicprofile_enablefirewall'
Name = 'EnableFirewall'
OffsetUri = '/MdmStore/PublicProfile/EnableFirewall'
AdditionalProperties = @{
'@odata.type' = '#microsoft.graph.deviceManagementConfigurationChoiceSettingDefinition'
}
},
@{
Id = 'vendor_msft_firewall_mdmstore_publicprofile_logfilepath'
Name = 'LogFilePath'
OffsetUri = '/MdmStore/PublicProfile/LogFilePath'
AdditionalProperties = @{
'@odata.type' = '#microsoft.graph.deviceManagementConfigurationStringSettingDefinition'
dependentOn = @(
@{
dependentOn = 'vendor_msft_firewall_mdmstore_publicprofile_enablefirewall_true'
parentSettingId = 'vendor_msft_firewall_mdmstore_publicprofile_enablefirewall'
}
)
}
}
)
},
@{
SettingDefinitions = @(
@{
Id = 'vendor_msft_firewall_mdmstore_hypervvmsettings_{vmcreatorid}_domainprofile_enablefirewall'
Name = 'EnableFirewall'
OffsetUri = '/MdmStore/HyperVVMSettings/{0}/DomainProfile/EnableFirewall'
AdditionalProperties = @{
'@odata.type' = '#microsoft.graph.deviceManagementConfigurationChoiceSettingDefinition'
options = @(
# Only option used in the tests is defined here
@{
name = 'Enable Firewall'
itemId = 'vendor_msft_firewall_mdmstore_hypervvmsettings_{vmcreatorid}_domainprofile_enablefirewall_true'
dependentOn = @(
@{
dependentOn = 'vendor_msft_firewall_mdmstore_hypervvmsettings_{vmcreatorid}_target_wsl'
parentSettingId = 'vendor_msft_firewall_mdmstore_hypervvmsettings_{vmcreatorid}_target'
}
)
}
)
}
},
@{
Id = 'vendor_msft_firewall_mdmstore_hypervvmsettings_{vmcreatorid}_publicprofile_enablefirewall'
Name = 'EnableFirewall'
OffsetUri = '/MdmStore/HyperVVMSettings/{0}/PublicProfile/EnableFirewall'
AdditionalProperties = @{
'@odata.type' = '#microsoft.graph.deviceManagementConfigurationChoiceSettingDefinition'
options = @(
# Only option used in the tests is defined here
@{
name = 'Enable Firewall'
itemId = 'vendor_msft_firewall_mdmstore_hypervvmsettings_{vmcreatorid}_publicprofile_enablefirewall_true'
dependentOn = @(
@{
dependentOn = 'vendor_msft_firewall_mdmstore_hypervvmsettings_{vmcreatorid}_target_wsl'
parentSettingId = 'vendor_msft_firewall_mdmstore_hypervvmsettings_{vmcreatorid}_target'
}
)
}
)
}
},
@{
Id = 'vendor_msft_firewall_mdmstore_hypervvmsettings_{vmcreatorid}_target'
Name = 'Target'
OffsetUri = '/MdmStore/HyperVVMSettings/{0}/Target'
AdditionalProperties = @{
'@odata.type' = '#microsoft.graph.deviceManagementConfigurationChoiceSettingDefinition'
options = @(
@{
dependentOn = @(
@{
dependentOn = 'vendor_msft_firewall_mdmstore_hypervvmsettings_{vmcreatorid}'
parentSettingId = 'vendor_msft_firewall_mdmstore_hypervvmsettings_{vmcreatorid}'
}
)
name = 'WSL'
itemId = 'vendor_msft_firewall_mdmstore_hypervvmsettings_{vmcreatorid}_target_wsl'
}
)
}
},
@{
Id = 'vendor_msft_firewall_mdmstore_hypervvmsettings_{vmcreatorid}'
Name = '{VMCreatorId}'
OffsetUri = '/MdmStore/HyperVVMSettings/{0}'
AdditionalProperties = @{
'@odata.type' = '#microsoft.graph.deviceManagementConfigurationSettingGroupCollectionDefinition'
childIds = @(
'vendor_msft_firewall_mdmstore_hypervvmsettings_{vmcreatorid}_target'
)
maximumCount = 1
minimumCount = 0
}
}
)
}
)
}

Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith {
}

Expand Down

0 comments on commit fbfbf20

Please sign in to comment.