How to fix Add user to Azure AD Security Group HTTP Call?

Alexandria Hernandez 0 Reputation points
2024-02-22T21:21:29.98+00:00

I'm not sure what to do with this graph command for adding a user to a security group. The security group is not a mail enabled security group, the AD authorization works because I'm using the same values for a REMOVE user from group HTTP Call. I tested this in the graph testing environment without issue. The service principal has the permissions needed for this call. The Body is throwing an error message that reads: User's image

URI User's image

User's image

BODY - i've tried both dynamic content for id and using a hard coded value.

{
    "@odata.id": "https://graph.microsoft.com/v1.0/directoryObjects/{id}"
}
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Dronec 181 Reputation points
    2024-02-23T04:38:28.4166667+00:00

    Try to POST

    {
        "@odata.id": "https://graph.microsoft.com/v1.0/users/{UserObjectID}"
    }
    
    

    Also, you certainly do not need curly brackets { } in your calls. Just post something like

    {    "@odata.id": "https://graph.microsoft.com/v1.0/users/0536d0ec-1494-4ae8-b117-36bf86c94ba2"}
    
    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.