Muokkaa

Jaa


directoryRole: delta

Namespace: microsoft.graph

Get newly created, updated, or deleted directory roles without having to perform a full read of the entire resource collection. For more information, see Use delta query to track changes in Microsoft Graph data for details.

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

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. The following least privileged roles are supported for this operation.

  • User Administrator
  • Helpdesk Administrator
  • Service Support Administrator
  • Billing Administrator
  • User
  • Mailbox Administrator
  • Directory Readers
  • Directory Writers
  • Application Administrator
  • Security Reader
  • Security Administrator
  • Privileged Role Administrator
  • Cloud Application Administrator
  • Customer LockBox Access Approver
  • Dynamics 365 Administrator
  • Power BI Administrator
  • Azure Information Protection Administrator
  • Desktop Analytics Administrator
  • License Administrator
  • Microsoft Managed Desktop Administrator
  • Authentication Administrator
  • Privileged Authentication Administrator
  • Teams Communications Administrator
  • Teams Communications Support Engineer
  • Teams Communications Support Specialist
  • Teams Administrator
  • Insights Administrator
  • Compliance Data Administrator
  • Security Operator
  • Kaizala Administrator
  • Global Reader
  • Volume Licensing Business Center User
  • Volume Licensing Service Center User
  • Modern Commerce Administrator
  • Microsoft Store for Business User
  • Directory Reviewer

HTTP request

To begin tracking changes, you make a request including the delta function on the directoryRole resource.

GET /directoryRoles/delta

Query parameters

Tracking changes incurs a round of one or more delta function calls. If you use any query parameter (other than $deltatoken and $skiptoken), you must specify it in the initial delta request. Microsoft Graph automatically encodes any specified parameters into the token portion of the @odata.nextLink or @odata.deltaLink URL provided in the response. You only need to specify any desired query parameters once upfront. In subsequent requests, copy and apply the @odata.nextLink or @odata.deltaLink URL from the previous response, as that URL already includes the encoded, desired parameters.

Query parameter Type Description
$deltatoken string A state token returned in the @odata.deltaLink URL of the previous delta function call for the same resource collection, indicating the completion of that round of change tracking. Save and apply the entire @odata.deltaLink URL including this token in the first request of the next round of change tracking for that collection.
$skiptoken string A state token returned in the @odata.nextLink URL of the previous delta function call, indicating there are further changes to be tracked in the same resource collection.

OData query parameters

This method supports OData query parameters to help customize the response.

  • You can use a $select query parameter as in any GET request to specify only the properties your need for best performance. The id property is always returned.

  • There is limited support for $filter:

    • The only supported $filter expression is for tracking changes for specific resources, by their id: $filter=id+eq+{value} or $filter=id+eq+{value1}+or+id+eq+{value2}. The number of ids you can specify is limited by the maximum URL length.

Request headers

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

Request body

Don't supply a request body for this method.

Response

If successful, this method returns a 200 OK response code and directoryRole collection object in the response body. The response also includes a @odata.nextLink URL or a @odata.deltaLink URL.

  • If a @odata.nextLink URL is returned, there are additional pages of data to be retrieved in the session. The application continues making requests using the @odata.nextLink URL until a @odata.deltaLink URL is included in the response.

  • If a @odata.deltaLink URL is returned, there is no more data about the existing state of the resource to be returned. Save @odata.deltaLink URL and apply it in the next delta call to learn about changes to the resource in the future.

Example

Request

GET https://graph.microsoft.com/v1.0/directoryRoles/delta

Response

Note: The response object shown here might be shortened for readability.

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

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#directoryRoles",
  "@odata.nextLink": "https://graph.microsoft.com/v1.0/directoryRoles/delta?$skiptoken=pkXMyA5aFCIMmH1Kk1XEAnf2X-fodqXKXF03gYPQknSHRxogVsxvSq_26nhos-O2-shortened",
  "value": [
    {
      "description": "Device Administrators",
      "displayName": "Azure AD Joined Device Local Administrator",
      "roleTemplateId": "9f06204d-73c1-4d4c-880a-6edb90606fd8",
      "id": "f8e85ed8-f66f-4058-b170-3efae8b9c6e5",
      "members@delta": [
        {
          "@odata.type": "#microsoft.graph.user",
          "id": "bb165b45-151c-4cf6-9911-cd7188912848",
          "@removed": {
            "reason": "deleted"
          }
        }
      ]
    }
  ]
}