List directoryAudits
Namespace: microsoft.graph
Get the list of audit logs generated by Microsoft Entra ID. This includes audit logs generated by various services within Microsoft Entra ID, including user, app, device and group Management, privileged identity management (PIM), access reviews, terms of use, identity protection, password management (self-service and admin password resets), and self- service group management, and so on.
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) | AuditLog.Read.All and Directory.Read.All | Not available. |
Delegated (personal Microsoft account) | Not supported. | Not supported. |
Application | AuditLog.Read.All and Directory.Read.All | Not available. |
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:
- Reports Reader
- Security Administrator
- Security Reader
HTTP request
GET /auditLogs/directoryaudits
Optional query parameters
This method supports the $filter
(eq
, ge
, le
, startswith
), $top
, $orderby
, and skiptoken
OData query parameters to help customize the response. For general information, see OData query parameters.
Request headers
Name | Description |
---|---|
Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
Request body
Don't supply a request body for this method.
Response
If successful, this method returns a 200 OK
response code and a collection of directoryAudit objects in the response body.
Examples
Example 1: Retrieve the list of audit logs
Request
The following example shows a request.
GET https://graph.microsoft.com/v1.0/auditLogs/directoryAudits
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#auditlogs/directoryaudits",
"value": [{
"id": "id",
"category": "UserManagement",
"correlationId": "da159bfb-54fa-4092-8a38-6e1fa7870e30",
"result": "success",
"resultReason": "Successfully added member to group",
"activityDisplayName": "Add member to group",
"activityDateTime": "2018-01-09T21:20:02.7215374Z",
"loggedByService": "Core Directory",
"initiatedBy": {
"user": {
"id": "728309ae-1a37-4937-9afe-e35d964db09b",
"displayName": "Audry Oliver",
"userPrincipalName": "bob@wingtiptoysonline.com",
"ipAddress": "127.0.0.1"
},
"app": null
},
"targetResources": [{
"id": "ef7e527d-6c92-4234-8c6d-cf6fdfb57f95",
"displayName": "Example.com",
"Type": "Group",
"modifiedProperties": [{
"displayName": "Action Client Name",
"oldValue": null,
"newValue": "DirectorySync"}],
"groupType": "unifiedGroups"
},
{
"id": "1f0e98f5-3161-4c6b-9b50-d488572f2bb7",
"displayName": null,
"Type": "User",
"modifiedProperties": [],
"userPrincipalName": "bob@contoso.com"
}],
"additionalDetails": [{
"key": "Additional Detail Name",
"value": "Additional Detail Value"
}]
}]
}
Example 2: Retrieve the list of audit logs with a filter on initiatedBy/user
Request
The following example shows a request.
GET https://graph.microsoft.com/v1.0/auditLogs/directoryAudits?$filter=initiatedBy/user/id eq '00000000-0000-0000-0000-000000000000'
Response
The following example shows the 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#auditLogs/directoryAudits",
"@microsoft.graph.tips": "Use $select to choose only the properties your app needs, as this can lead to performance improvements. For example: GET auditLogs/directoryAudits?$select=activityDateTime,activityDisplayName",
"value": [
{
"id": "SSGM_b662f17a-4e4d-4e1c-9248-cdec180024b2_MCDC4_88453290",
"category": "GroupManagement",
"correlationId": "b662f17a-4e4d-4e1c-9248-cdec180024b2",
"result": "success",
"resultReason": "OK",
"activityDisplayName": "GroupLifecyclePolicies_Get",
"activityDateTime": "2024-12-27T10:01:19.5796748Z",
"loggedByService": "Self-service Group Management",
"operationType": "Update",
"initiatedBy": {
"app": null,
"user": {
"id": "00000000-0000-0000-0000-000000000000",
"displayName": null,
"userPrincipalName": null,
"ipAddress": "10.0.0.0",
"userType": null,
"homeTenantId": null,
"homeTenantName": null
}
},
"targetResources": [
{
"id": "00000000-0000-0000-0000-000000000000",
"displayName": null,
"type": "N/A",
"userPrincipalName": null,
"groupType": null,
"modifiedProperties": []
}
],
"additionalDetails": []
}
]
}