If you don't append /$ref to the request and the calling app has permissions to manage the member object, the object will also be deleted from Azure Active Directory (Azure AD); otherwise, a 403 Forbidden error is returned. 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.
Example
Request
The following is an example of the request. In the example below, {id1} represents the identifier for the target administrative unit, and {id2} represents the unique identifier for the member user, group, or device to be removed from the target administrative unit.
// Code snippets are only available for the latest version. Current version is 5.x
var graphClient = new GraphServiceClient(requestAdapter);
await graphClient.Directory.AdministrativeUnits["{administrativeUnit-id}"].Members["{directoryObject-id}"].Ref.DeleteAsync();
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc directory administrative-units members ref delete --administrative-unit-id {administrativeUnit-id} --directory-object-id {directoryObject-id}
<?php
// THIS SNIPPET IS A PREVIEW VERSION OF THE SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$graphServiceClient->directory()->administrativeUnits()->byAdministrativeUnitId('administrativeUnit-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.directory.administrative_units.by_administrative_unit_id('administrativeUnit-id').members.by_member_id('directoryObject-id').ref.delete()