Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix export of Firewall policy settings #5518

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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