Use this API to add a member (user, group, or device) to an administrative unit. Currently it's only possible to add one member at a time to an administrative unit.
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
Permission type
Permissions (from least to most privileged)
Delegated (work or school account)
AdministrativeUnit.ReadWrite.All
Delegated (personal Microsoft account)
Not supported.
Application
AdministrativeUnit.ReadWrite.All
To add a member to an administrative unit, the calling principal must be assigned one of the following Azure AD roles:
Privileged Role Administrator
Global Administrator
HTTP request
POST /directory/administrativeUnits/{id}/members/$ref
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := graphmodels.NewReferenceCreate()
"@odata.id" := "https://graph.microsoft.com/v1.0/groups/{id}"
requestBody.Set"@odata.id"(&"@odata.id")
graphClient.Directory().AdministrativeUnitsById("administrativeUnit-id").Members().$ref().Post(requestBody)
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new ReferenceCreate();
$requestBody->set@odataid('https://graph.microsoft.com/v1.0/groups/{id}');
$graphServiceClient->directory()->administrativeUnitsById('administrativeUnit-id')->members()->ref()->post($requestBody);