Azure / securedworkstation

Intune managed Secured workstation
MIT License
234 stars 54 forks source link

SPE:Import-SPE-DeviceCompliancePolicies.ps1 exclusionGroupAssignmentTarget and groupAssignmentTarget broken #10

Open adelino-sdsu opened 3 years ago

adelino-sdsu commented 3 years ago

Was running MasterScript-SPE.ps1, running into this error on each Device Compliance Policy

Response content:
{"error":{"code":"BadRequest","message":"Invalid OData type specified: \"microsoft.graph.#microsoft.graph.exclusionGroupAssignmentTarget\"","innerError":{"date":"2021-11-19T19:27:57","request-id":"3f0e46b6-a2b4-4863-a0b7-fd46c1c4d0cd","client-request-id":"3f0e46b6-a2b4-4863-a0b7-fd46c1c4d0cd"}}}
Add-DeviceCompliancePolicyAssignment : Request to
https://graph.microsoft.com/v1.0/deviceManagement/deviceCompliancePolicies/a47b7f6c-4839-499e-a28b-50be9940b832/assign
failed with HTTP Status BadRequest Bad Request
At C:\users\adelino\downloads\securedworkstation-master\securedworkstation-master\SPE\Import-SPE-DeviceCompliancePolici
es.ps1:625 char:13
+             Add-DeviceCompliancePolicyAssignment -ComplianceAssignmen ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Add-DeviceCompliancePolicyAssignment

I was able to get it working by

1) Modifying Import-SPE-DeviceCompliancePolicies.ps1 line 615 from

old: "@odata.type": "#microsoft.graph.$Assignment", fixed: "@odata.type": "$Assignment",

simorjay commented 1 year ago

Thanks for the feedback - will work with the team to resolve