directory_audits
Retrieve Entra ID directory audit events to see who performed admin actions, when, and which targets were affected. Filter by category or user to distinguish handled actions from open incidents.
Instructions
Who did what to the directory, and when -- the operator-side counterpart to signin_logs.
Every admin action against a user object (block/unblock, password reset,
role assignment, attribute edits) appears here, naming the actor
(initiated_by) and the affected object(s) (target_resources).
This is the record a manual "unblock and reset" intervention -- like the
one that closed the 2026-08-21 case this server exists to shorten --
leaves behind; it is how a later triage can tell "already handled by a
human" from "still open".
user, when given, matches audits where that account is either the
initiator or a target resource. Graph's directoryAudits endpoint only
supports server-side $filter on the initiator
(initiatedBy/user/userPrincipalName), not on targetResources, so
this fetches the full time window and matches both sides client-side --
a window with many unrelated admin actions can need a larger
max_pages budget than signin_logs/signin_failure_stats to
find one specific user's audits; capped=true warns when that budget
ran out before the window was fully scanned.
Read-only (AuditLog.Read.All application permission, or -- for azure-cli auth -- the Reports Reader directory role). Entra ID retains directory audit logs for 30 days, same as sign-in logs.
Time-bounded: the scan stops after ENTRAADM_DEADLINE seconds (default 45)
and returns what it has with capped=true. Over several days the log is
dominated by device-registration noise ("Update device"), so pass
category (for example UserManagement, RoleManagement,
GroupManagement, ApplicationManagement) to have Graph filter
server-side; that keeps a multi-day window inside the budget.
Args: category: Only this Graph audit category (letters only; default: all). user: Restrict to audits naming this userPrincipalName as actor or target (default: all). hours: How far back to look, clamped to [1, 720] (30 days). top: Maximum records to return, clamped to [1, 500]. max_pages: Page budget (default: ENTRAADM_MAX_PAGES_DEFAULT). tenant: Tenant to read: a [tenant.] section name or one of its domains (default: the default tenant).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| top | No | ||
| user | No | ||
| hours | No | ||
| tenant | No | ||
| category | No | ||
| max_pages | No |