How do I assign an ESP to multiple groups using graph API?

Johan Berg 65 Reputation points
2023-05-26T00:25:52.45+00:00

Hi,

To assign ESP to one group I use the following code.

(Thanx to @Crystal-MSFT answer in an earlier question)

Request Body:

{
    "enrollmentConfigurationAssignments": [
        {
            "target": {
                "@odata.type": "#microsoft.graph.groupAssignmentTarget",
                "groupId": "<The group id you want assign ESP to>"
            }
        }
    ]
}

But how do I assign it to multiple groups?

Br

Johan

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,381 questions
Microsoft Intune Configuration
Microsoft Intune Configuration
Microsoft Intune: A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.Configuration: The process of arranging or setting up computer systems, hardware, or software.
1,802 questions
Microsoft Intune Enrollment
Microsoft Intune Enrollment
Microsoft Intune: A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.Enrollment: The process of requesting, receiving, and installing a certificate.
1,315 questions
0 comments No comments
{count} votes

Accepted answer
  1. Crystal-MSFT 46,171 Reputation points Microsoft Vendor
    2023-05-26T02:22:21.7333333+00:00

    @Johan Berg, Thanks for posting in Q&A.

    To assign to multiple groups, you can use the similar format as the above. Add each group into the request body. Here is an example to add two groups:

    {
        "enrollmentConfigurationAssignments": [
            {
                "target": {
                    "@odata.type": "#microsoft.graph.groupAssignmentTarget",
                    "groupId": "The group id you want assign ESP to"
                }
            },
            {
                "target": {
                    "@odata.type": "#microsoft.graph.groupAssignmentTarget",
                    "groupId": "The group id you want assign ESP to"
                }
            }
        ]
    }
    

    User's image

    Then the two groups display under the ESP assignment:

    User's image

    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.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful