Forum Discussion
nsovilj
Jun 01, 2023Copper Contributor
Intune Device Compliance policy assignment POST - No OData route exists
I have created a compliance policy via Graph API but another command, New-MgDeviceManagementDeviceCompliancePolicyAssignment, is needed to assign a group to that compliance policy. I have found ID of...
AMCodyP
Jul 08, 2023Copper Contributor
This is the code that I'm using:
$body = [Microsoft.Graph.PowerShell.Models.IMicrosoftGraphDeviceManagementConfigurationPolicyAssignment] @{
Target = @{
'groupId' = $Group.Id
'@odata.type' = '#microsoft.graph.groupAssignmentTarget'
}
}
New-MgDeviceManagementDeviceConfigurationAssignment -DeviceConfigurationId $Group.Id -BodyParameter @body
$body = [Microsoft.Graph.PowerShell.Models.IMicrosoftGraphDeviceManagementConfigurationPolicyAssignment] @{
Target = @{
'groupId' = $Group.Id
'@odata.type' = '#microsoft.graph.groupAssignmentTarget'
}
}
New-MgDeviceManagementDeviceConfigurationAssignment -DeviceConfigurationId $Group.Id -BodyParameter @body