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.

1 Answer 1

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 and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.