Upravit

Sdílet prostřednictvím


Update unifiedRoleDefinition

Namespace: microsoft.graph

Update the properties of a unifiedRoleDefinition object. You cannot update built-in roles. This feature requires a Microsoft Entra ID P1 or P2 license.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) RoleManagement.ReadWrite.Directory Directory.ReadWrite.All
Delegated (personal Microsoft account) Not supported. Not supported.
Application RoleManagement.ReadWrite.Directory Directory.ReadWrite.All

Important

In delegated scenarios with work or school accounts, the signed-in user must be assigned a supported Microsoft Entra role or a custom role with a supported role permission. Privileged Role Administrator is the least privileged role supported for this operation.

HTTP request

PATCH /roleManagement/directory/roleDefinitions/{id}

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json. Required.

Request body

In the request body, supply the values for relevant fields that should be updated. Existing properties that are not included in the request body will maintain their previous values or be recalculated based on changes to other property values. For the best performance, don't include existing values that haven't changed.

The following table shows the properties that are required when you update the unifiedRoleDefinition.

Property Type Description
description String The description for the role definition. Read-only when isBuiltIn is true.
displayName String The display name for the role definition. Read-only when isBuiltIn is true. Required.
isEnabled Boolean Flag indicating if the role is enabled for assignment. If false, the role is not available for assignment. Read-only when isBuiltIn is true.
rolePermissions unifiedRolePermission collection List of permissions included in the role. Read-only when isBuiltIn is true. Required.
templateId String Custom template identifier that can be set when isBuiltIn is false. This identifier is typically used if one needs an identifier to be the same across different directories. Read-only when isBuiltIn is true.
version String Indicates version of the role definition. Read-only when isBuiltIn is true.

Response

If successful, this method returns a 204 No Content response code. It doesn't return anything in the response body.

Example

Request

The following example shows a request.

PATCH https://graph.microsoft.com/v1.0/roleManagement/directory/roleDefinitions/0d55728d-3e24-4309-9b1b-5ac09921475a
Content-type: application/json

{
  "description": "Update basic properties of application registrations",
  "displayName": "Application Registration Support Administrator",
  "rolePermissions":
    [
        {
            "allowedResourceActions": 
            [
                "microsoft.directory/applications/basic/read"
            ]
        }
    ]
}

Response

The following example shows the response.

HTTP/1.1 204 OK
Content-type: application/json