msgraph-sdk-powershell
msgraph-sdk-powershell copied to clipboard
Issue with New-MgGroupMemberByRef ?
Trying to add a user to an AAD group, I did the following:
$params = @{
"@odata.id"= "https://graph.microsoft.com/v1.0/users/47f666c9-xxxx-xxxx-xxxxxxxxxxxx"
}
New-MgGroupMemberByRef -GroupId 66fa7ce5-xxxx-xxxx-xxxxxxxxxxxx -BodyParameter $params
But surprisingly, I get this error: New-MgGroupMemberByRef : A parameter cannot be found that matches parameter name 'BodyParameter'. At line:1 char:70
Which doesn't seem to make sense according the docs.
Thanks for following up on this.
Unfortunately, the bug was caused by a missing request body in the OpenAPI file used to generate the module. I've opened an issue at https://github.com/microsoftgraph/microsoft-graph-devx-api/issues/1129 for this to be fixed in the OpenAPI file. We will provide a patch as soon as the fix is available.
As a workaround, you can use New-MgGroupMember add a user to an AAD group as we work on a fix.