Create scopedRoleMembership

Use this API to create a new scopedRoleMembership. NOTE: Only the User account administrator and Helpdesk administrator roles are supported for scoped-role memberships.

Prerequisites

The following scopes are required to execute this API: Directory.AccessAsUser.All

HTTP request

POST /administrativeUnits/{id}/scopedAdministrators

Request headers

Name Description
Authorization Bearer . Required.

Request body

In the request body, supply a JSON representation of scopedRoleMembership object.

Response

If successful, this method returns 201, Created response code and scopedRoleMembership object in the response body.

Example

Request

Here is an example of the request.

POST https://graph.microsoft.com/beta/administrativeUnits/{id}/scopedAdministrators
Content-type: application/json
Content-length: 272

{
  "roleId": "roleId-value",
  "roleMemberInfo": {
    "id": "id-value"
  }
}

In the request body, supply a JSON representation of scopedRoleMembership object.

Response

Here is an example of the response. Note: The response object shown here may be truncated for brevity. All of the properties will be returned from an actual call.

HTTP/1.1 201 Created
Content-type: application/json
Content-length: 294

{
  "@odata.context":"https://graph.microsoft.com/beta/$metadata#scopedRoleMemberships/$entity",
  "administrativeUnitId": "administrativeUnitId-value",
  "roleId": "roleId-value",
  "roleMemberInfo": {
    "id": "id-value",
    "displayName": "displayName-value",
    "userPrincipalName": "userPrincipalName-value"
  },
  "id": "id-value"
}