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

PR:IntuneDeviceEnrollmentPlatformRestriction - Fixes 3730 #4054

Merged
merged 6 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change log for Microsoft365DSC

# UNRELEASED

* IntuneDeviceEnrollmentPlatformRestriction
* Fix Set-TargetResource due to an issue were the bodyparameter not cast correctly
FIXES [#3730](https://github.com/microsoft/Microsoft365DSC/issues/3730)

# 1.23.1213.1

* IntuneEndpointDetectionAndResponsePolicyWindows10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,7 @@ function Set-TargetResource
#endregion

$currentCategory = Get-TargetResource @PSBoundParameters
$PSBoundParameters.Remove('Credential') | Out-Null
$PSBoundParameters.Remove('ApplicationId') | Out-Null
$PSBoundParameters.Remove('TenantId') | Out-Null
$PSBoundParameters.Remove('ApplicationSecret') | Out-Null
$PSBoundParameters.Remove('ManagedIdentity') | Out-Null
$PSBoundParameters.Remove('Ensure') | Out-Null
$PSBoundParameters.Remove('CertificateThumbprint') | Out-Null
$PSBoundParameters.Remove('Verbose') | Out-Null
$PSBoundParameters = Remove-M365DSCAuthenticationParameter -BoundParameters $PSBoundParameters
$PSBoundParameters.Remove('Identity') | Out-Null

if ($Ensure -eq 'Present' -and $currentCategory.Ensure -eq 'Absent')
Expand Down Expand Up @@ -326,10 +319,10 @@ function Set-TargetResource
}
$PSBoundParameters.add('@odata.type', $policyType)

Write-Verbose ($PSBoundParameters | ConvertTo-Json -Depth 20)
#Write-Verbose ($PSBoundParameters | ConvertTo-Json -Depth 20)

$policy = New-MgBetaDeviceManagementDeviceEnrollmentConfiguration `
-BodyParameter $PSBoundParameters
-BodyParameter ([hashtable]$PSBoundParameters)

#Assignments from DefaultPolicy are not editable and will raise an alert
if ($policy.Id -notlike '*_DefaultPlatformRestrictions')
Expand Down Expand Up @@ -384,9 +377,9 @@ function Set-TargetResource
$policyType = '#microsoft.graph.deviceEnrollmentPlatformRestrictionsConfiguration'
}
$PSBoundParameters.add('@odata.type', $policyType)
Write-Verbose ($PSBoundParameters | ConvertTo-Json -Depth 20)
#Write-Verbose ($PSBoundParameters | ConvertTo-Json -Depth 20)
Update-MgBetaDeviceManagementDeviceEnrollmentConfiguration `
-BodyParameter $PSBoundParameters `
-BodyParameter ([hashtable]$PSBoundParameters) `
-DeviceEnrollmentConfigurationId $Identity

#Assignments from DefaultPolicy are not editable and will raise an alert
Expand Down Expand Up @@ -547,11 +540,8 @@ function Test-TargetResource
}
}

$ValuesToCheck.Remove('Credential') | Out-Null
$ValuesToCheck.Remove('ApplicationId') | Out-Null
$ValuesToCheck.Remove('TenantId') | Out-Null
$ValuesToCheck.Remove('ApplicationSecret') | Out-Null
$ValuesToCheck.Remove('Id') | Out-Null
$ValuesToCheck = Remove-M365DSCAuthenticationParameter -BoundParameters $ValuesToCheck
$ValuesToCheck.Remove('Identity') | Out-Null
$ValuesToCheck.Remove('WindowsMobileRestriction') | Out-Null

#Convert any DateTime to String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,12 +591,6 @@ function Test-TargetResource
}
}

$ValuesToCheck.Remove('Id') | Out-Null
$ValuesToCheck.Remove('Credential') | Out-Null
$ValuesToCheck.Remove('ApplicationId') | Out-Null
$ValuesToCheck.Remove('TenantId') | Out-Null
$ValuesToCheck.Remove('ApplicationSecret') | Out-Null

Write-Verbose -Message "Current Values: $(Convert-M365DscHashtableToString -Hashtable $CurrentValues)"
Write-Verbose -Message "Target Values: $(Convert-M365DscHashtableToString -Hashtable $ValuesToCheck)"

Expand Down
Loading