0

Calling the following code:

$uri = "https://graph.microsoft.com/v1.0/groups/[groupID]/members/`$ref"
$body = (@{'@odata.id'='https://graph.microsoft.com/v1.0/directoryObjects/[memberID]'} | ConvertTo-JSON)
Invoke-WebRequest -Method "POST" -Uri $uri -ContentType "application/json" -Headers @{Authorization = "Bearer $retrievedToken"} -Body $body -UseBasicParsing -Verbose

Returns:

Invoke-WebRequest : { "error": { "code": "Request_BadRequest", "message": "No URI value was found for
an entity reference link. A single URI value was expected."

Obs.: The same request in Graph Explorer works as expected.

0

Worked with:

$uri = "https://graph.microsoft.com/v1.0/groups/[groupID]/members/`$ref"
$body = (@{'@odata.id'='https://graph.microsoft.com/v1.0/directoryObjects/[MemberID]'} | ConvertTo-JSON)
Invoke-WebRequest -Method "POST" -Uri $uri -ContentType "application/json" -Headers @{Authorization = "Bearer $token"} -Body $body

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.