Add group member 400 Bad Request

Copper Contributor

I keep getting a 400 Bad Request when adding members to groups via graph api in powershell.  I think it's an issue with oddata part and passing the user id.  

I tried a few different ways with the $body part but keep getting 400 bad requests errors.

What's the correct way to pass the userid when adding a new member to a group?

These are the commands I'm using in powershell:

$userid =''

$URL = '$ref'

$Body = @{
>> '' = "$($userid)"
>> }


Invoke-RestMethod -Headers $headers -Uri $URL -Method POST -Body $body -ContentType 'application/json'

0 Replies