@Swahela Mulla, Thanks for posting in Q&A. Based on the Dev log I captured when I add the user group in UI. I find it uses POST action and all the groups we want to add needs to include int he Request Body. For example, I want to add group 2 into the assignment while there's already group 1 in the assignment. I add both two groups' id in the request body.POST
https://graph.microsoft.com/beta/deviceManagement/deviceHealthScripts/{deviceHealthScriptId}/assignRequest Body:
{
"deviceHealthScriptAssignments": [
{
"id": "6eb09d44-bxxxxxxx7a524d44f147",
"target": {
"@odata.type": "#microsoft.graph.groupAssignmentTarget",
"groupId": "group 1 id",
"deviceAndAppManagementAssignmentFilterId": "00000000-0000-0000-0000-000000000000"
},
"runRemediationScript": true,
"runSchedule": {
"@odata.type": "#microsoft.graph.deviceHealthScriptDailySchedule",
"interval": 1,
"time": "8:0:0",
"useUtc": false
}
},
{
"target": {
"@odata.type": "#microsoft.graph.groupAssignmentTarget",
"groupId": "group 2 id"
},
"runRemediationScript": true,
"runSchedule": {
"@odata.type": "#microsoft.graph.deviceHealthScriptDailySchedule",
"interval": 1,
"time": "8:0:0",
"useUtc": false
}
}
]
}
Hope the above information can help.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.