To remove members from a role-assignable group, the calling user must also be assigned the RoleManagement.ReadWrite.Directory permission.
HTTP request
DELETE /groups/{id}/members/{id}/$ref
Caution
If /$ref is not appended to the request and the calling app has permissions to manage the member object type, the member object will also be deleted from Azure Active Directory (Azure AD); otherwise, a 403 Forbidden error is returned. For example, an app with both GroupMember.ReadWrite.All and User.ReadWrite.All permissions will delete a user. You can restore specific objects through the Restore deleted items API.
Request headers
Name
Description
Authorization
Bearer {token}. Required.
Request body
Do not supply a request body for this method.
Response
If successful, this method returns 204 No Content response code. It does not return anything in the response body.
// Code snippets are only available for the latest version. Current version is 5.x
var graphClient = new GraphServiceClient(requestAdapter);
await graphClient.Groups["{group-id}"].Members["{directoryObject-id}"].Ref.DeleteAsync();
<?php
// THIS SNIPPET IS A PREVIEW VERSION OF THE SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$graphServiceClient->groups()->byGroupId('group-id')->members()->byDirectoryObjectId('directoryObject-id')->ref()->delete()->wait();
# THE PYTHON SDK IS IN PREVIEW. FOR NON-PRODUCTION USE ONLY
graph_client = GraphServiceClient(request_adapter)
await graph_client.groups.by_group_id('group-id').members.by_member_id('directoryObject-id').ref.delete()