Microsoft
Entra ID audit logs
Directory changes in Entra ID: users, groups, roles, applications, consent, MFA methods, Conditional Access and federation.
Why it matters
Persistence in a Microsoft tenant is a directory change: a new MFA method, a role assignment, consent to an app, credentials on a service principal, or a federation change. All of them land here.
How long it lasts
- Entra ID Free: 7 days. P1 or P2: 30 days.
- Export with diagnostic settings to keep more. The unified audit log also carries most directory events for its own retention period.
Get the data
Get-MgAuditLogDirectoryAudit -Filter "activityDateTime ge 2026-01-01" -All |
Select-Object activityDateTime, activityDisplayName, @{n='by';e={$_.InitiatedBy.User.UserPrincipalName}}, resultFields that matter
activityDisplayNameSentinel: OperationName
The change, for example Add member to role or Consent to application.
initiatedBySentinel: InitiatedBy
The user or app that made the change, with its IP.
targetResourcesSentinel: TargetResources
What was changed, with modifiedProperties showing old and new values.
category / loggedByServiceSentinel: Category / LoggedByService
Which part of Entra ID logged it, for example Authentication Methods or Core Directory.
resultSentinel: Result
success or failure.
Traps
- MFA method changes made by the user and by an admin have different activity names. Hunt for both.
- Consent grants show the permissions only inside modifiedProperties; the activity name alone does not tell you the scope.
- Changes made through Graph by an app are attributed to the app, not the human who controls it.