Skip to content

Commit

Permalink
Fix request being sent
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmestre committed Nov 15, 2024
1 parent a0f2ae5 commit 44cdaff
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 32 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
applicationEnforcedRestrictions parameter when value was set to false, which throws an error.
* AADRoleEligibilityScheduleRequest
* Adds support for custom role assignments at app scope.
* IntuneDeviceConfigurationPolicyAndroidDeviceOwner
* Fixed issue when properties `DetailedHelpText`,
`DeviceOwnerLockScreenMessage` or `ShortHelpText` were defined but the
request was not being sent correctly
FIXES [#5411](https://github.com/microsoft/Microsoft365DSC/issues/5411)
* IntuneFirewallRulesHyperVPolicyWindows10
* Initial release.
* M365DSCDRGUtil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ function Get-TargetResource

$complexAzureAdSharedDeviceDataClearApps = @()
$currentValueArray = $getValue.AdditionalProperties.azureAdSharedDeviceDataClearApps
if ($null -ne $currentValueArray -and $currentValueArray.count -gt 0 )
if ($null -ne $currentValueArray -and $currentValueArray.count -gt 0)
{
foreach($currentValue in $currentValueArray)
{
Expand All @@ -686,10 +686,10 @@ function Get-TargetResource
$currentValue = $getValue.AdditionalProperties.detailedHelpText
if ($null -ne $currentValue)
{
$complexDetailedHelpText.Add('DefaultMessage',$currentValue.defaultMessage)
$complexDetailedHelpText.Add('DefaultMessage', $currentValue.defaultMessage)
$complexLocalizedMessages = @()
$currentValueArray = $currentValue.localizedMessages
if ($null -ne $currentValueArray -and $currentValueArray.count -gt 0 )
if ($null -ne $currentValueArray -and $currentValueArray.count -gt 0)
{
foreach($currentChildValue in $currentValueArray)
{
Expand All @@ -700,17 +700,17 @@ function Get-TargetResource
$complexLocalizedMessages += $currentHash
}
}
$complexDetailedHelpText.Add('LocalizedMessages',$complexLocalizedMessages)
$complexDetailedHelpText.Add('LocalizedMessages', $complexLocalizedMessages)
}

$complexDeviceOwnerLockScreenMessage = @{}
$currentValue = $getValue.AdditionalProperties.deviceOwnerLockScreenMessage
if ($null -ne $currentValue)
{
$complexDeviceOwnerLockScreenMessage.Add('DefaultMessage',$currentValue.defaultMessage)
$complexDeviceOwnerLockScreenMessage.Add('DefaultMessage', $currentValue.defaultMessage)
$complexLocalizedMessages = @()
$currentValueArray = $currentValue.localizedMessages
if ($null -ne $currentValueArray -and $currentValueArray.count -gt 0 )
if ($null -ne $currentValueArray -and $currentValueArray.count -gt 0)
{
foreach($currentChildValue in $currentValueArray)
{
Expand All @@ -721,48 +721,48 @@ function Get-TargetResource
$complexLocalizedMessages += $currentHash
}
}
$complexDeviceOwnerLockScreenMessage.Add('LocalizedMessages',$complexLocalizedMessages)
$complexDeviceOwnerLockScreenMessage.Add('LocalizedMessages', $complexLocalizedMessages)
}

$complexGlobalProxy = @{}
$currentValue = $getValue.AdditionalProperties.globalProxy
if ($null -ne $currentValue)
{
$complexGlobalProxy.Add('ProxyAutoConfigURL',$currentValue.proxyAutoConfigURL)
$complexGlobalProxy.Add('ExcludedHosts',$currentValue.excludedHosts)
$complexGlobalProxy.Add('Host',$currentValue.host)
$complexGlobalProxy.Add('Port',$currentValue.port)
$complexGlobalProxy.Add('oDataType',$currentValue.'@odata.type')
$complexGlobalProxy.Add('ProxyAutoConfigURL', $currentValue.proxyAutoConfigURL)
$complexGlobalProxy.Add('ExcludedHosts', $currentValue.excludedHosts)
$complexGlobalProxy.Add('Host', $currentValue.host)
$complexGlobalProxy.Add('Port', $currentValue.port)
$complexGlobalProxy.Add('oDataType', $currentValue.'@odata.type')
}

$complexKioskModeApps = @()
$currentValueArray = $getValue.AdditionalProperties.kioskModeApps
if ($null -ne $currentValueArray -and $currentValueArray.count -gt 0 )
if ($null -ne $currentValueArray -and $currentValueArray.count -gt 0)
{
foreach($currentValue in $currentValueArray)
{
$currentHash = @{}
$currentHash.add('AppId',$currentValue.appid)
$currentHash.add('Publisher',$currentValue.publisher)
$currentHash.add('AppStoreUrl',$currentValue.appStoreUrl)
$currentHash.add('Name',$currentValue.name)
$currentHash.add('oDataType',$currentValue.'@odata.type')
$currentHash.add('AppId', $currentValue.appid)
$currentHash.add('Publisher', $currentValue.publisher)
$currentHash.add('AppStoreUrl', $currentValue.appStoreUrl)
$currentHash.add('Name', $currentValue.name)
$currentHash.add('oDataType', $currentValue.'@odata.type')
$complexKioskModeApps += $currentHash
}
}

$complexPersonalProfilePersonalApplications = @()
$currentValueArray = $getValue.AdditionalProperties.personalProfilePersonalApplications
if ($null -ne $currentValueArray -and $currentValueArray.count -gt 0 )
if ($null -ne $currentValueArray -and $currentValueArray.count -gt 0)
{
foreach($currentValue in $currentValueArray)
{
$currentHash = @{}
$currentHash.add('AppId',$currentValue.appid)
$currentHash.add('Publisher',$currentValue.publisher)
$currentHash.add('AppStoreUrl',$currentValue.appStoreUrl)
$currentHash.add('Name',$currentValue.name)
$currentHash.add('oDataType',$currentValue.'@odata.type')
$currentHash.add('AppId', $currentValue.appid)
$currentHash.add('Publisher', $currentValue.publisher)
$currentHash.add('AppStoreUrl', $currentValue.appStoreUrl)
$currentHash.add('Name', $currentValue.name)
$currentHash.add('oDataType', $currentValue.'@odata.type')
$complexPersonalProfilePersonalApplications += $currentHash
}
}
Expand All @@ -771,10 +771,10 @@ function Get-TargetResource
$currentValue = $getValue.AdditionalProperties.shortHelpText
if ($null -ne $currentValue)
{
$complexShortHelpText.Add('DefaultMessage',$currentValue.defaultMessage)
$complexShortHelpText.Add('DefaultMessage', $currentValue.defaultMessage)
$complexLocalizedMessages = @()
$currentValueArray = $currentValue.localizedMessages
if ($null -ne $currentValueArray -and $currentValueArray.count -gt 0 )
if ($null -ne $currentValueArray -and $currentValueArray.count -gt 0)
{
foreach($currentChildValue in $currentValueArray)
{
Expand All @@ -785,20 +785,20 @@ function Get-TargetResource
$complexLocalizedMessages += $currentHash
}
}
$complexShortHelpText.Add('LocalizedMessages',$complexLocalizedMessages)
$complexShortHelpText.Add('LocalizedMessages', $complexLocalizedMessages)
}

$complexSystemUpdateFreezePeriods = @()
$currentValueArray = $getValue.AdditionalProperties.systemUpdateFreezePeriods
if ($null -ne $currentValueArray -and $currentValueArray.count -gt 0 )
if ($null -ne $currentValueArray -and $currentValueArray.count -gt 0)
{
foreach($currentValue in $currentValueArray)
{
$currentHash = @{}
$currentHash.Add('StartDay',$currentValue.startDay)
$currentHash.Add('EndDay',$currentValue.endDay)
$currentHash.Add('StartMonth',$currentValue.startMonth)
$currentHash.Add('EndMonth',$currentValue.endMonth)
$currentHash.Add('StartDay', $currentValue.startDay)
$currentHash.Add('EndDay', $currentValue.endDay)
$currentHash.Add('StartMonth', $currentValue.startMonth)
$currentHash.Add('EndMonth', $currentValue.endMonth)
$complexSystemUpdateFreezePeriods += $currentHash
}
}
Expand Down Expand Up @@ -1644,6 +1644,19 @@ function Set-TargetResource

foreach ($key in ($CreateParameters.clone()).Keys)
{
if ($key -eq 'DetailedHelpText' -or $key -eq 'DeviceOwnerLockScreenMessage' -or $key -eq 'ShortHelpText')
{
if ($null -ne $CreateParameters.$key.DefaultMessage -or $null -ne $CreateParameters.$key.LocalizedMessages)
{
$CreateParameters.$key.Add('@odata.type', '#microsoft.graph.androidDeviceOwnerUserFacingMessage')
}

if ($null -eq $CreateParameters.$key.LocalizedMessages)
{
$CreateParameters.$key.Add('localizedMessages', @())
}
}

if ($CreateParameters[$key].getType().Fullname -like '*CimInstance*')
{
$CreateParameters[$key] = Convert-M365DSCDRGComplexTypeToHashtable -ComplexObject $CreateParameters[$key]
Expand Down Expand Up @@ -1684,6 +1697,19 @@ function Set-TargetResource

foreach ($key in (($UpdateParameters.clone()).Keys | Sort-Object))
{
if ($key -eq 'DetailedHelpText' -or $key -eq 'DeviceOwnerLockScreenMessage' -or $key -eq 'ShortHelpText')
{
if ($null -ne $UpdateParameters.$key.DefaultMessage -or $null -ne $UpdateParameters.$key.LocalizedMessages)
{
$UpdateParameters.$key.Add('@odata.type', '#microsoft.graph.androidDeviceOwnerUserFacingMessage')
}

if ($null -eq $UpdateParameters.$key.LocalizedMessages)
{
$UpdateParameters.$key.Add('localizedMessages', @())
}
}

if ($UpdateParameters.$key.getType().Fullname -like '*CimInstance*')
{
$UpdateParameters.$key = Convert-M365DSCDRGComplexTypeToHashtable -ComplexObject $UpdateParameters.$key
Expand Down

0 comments on commit 44cdaff

Please sign in to comment.