Add directory role member

Use this API to create a new directory role member.

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) Directory.AccessAsUser.All
Delegated (personal Microsoft account) Not supported.
Application Not supported.

HTTP request

POST /directoryRoles/{id}/members/$ref

Request headers

Name Type Description
Authorization string Bearer {token}. Required.
Content-Type application/json  

Request body

In the request body, supply a JSON representation of a directoryObject or user object to be added.

Response

If successful, this method returns 204, No Content response code.

Example

Request
POST https://graph.microsoft.com/v1.0/directoryRoles/{id}/members
Content-type: application/json

{
  "@odata.id": "https://graph.microsoft.com/v1.0/directoryObjects/{id}"
}
Response

Note: The response object shown here may be truncated for brevity.

HTTP/1.1 204 No Content
Content-type: text/plain