Consent to Application vs. Add OAuth2PermissionGrant: Log Correlation Guide
In Microsoft Entra Audit Logs, a single user OAuth consent generates three correlated records sharing a correlationId: "Add service principal" (creating the local app instance if new), "Consent to application" (capturing the user, IP, and IsAdminConsent flag), and "Add OAuth2PermissionGrant" (recording the exact delegated API scopes persisted in Entra).
Architecture & Telemetry Context
When SOC analysts pull Entra Directory Audit logs during an application phishing investigation, seeing three separate events fire milliseconds apart for a single click can feel confusing: `Add service principal`, `Consent to application`, and `Add OAuth2PermissionGrant`.
Each of those three audit records exposes a different critical piece of forensic evidence—and missing one means missing either the attacker’s origin IP, whether tenant-wide Admin Consent occurred, or the exact Graph scopes exposed.
Tracing the sequence chronologically makes the architecture clear: first, if no enterprise instance of that multi-tenant AppId existed in your tenant before, Entra runs `Add service principal` (showing the global AppId and Publisher). Next, `Consent to application` logs who clicked Accept (`initiatedBy`), their `ipAddress`, and `ConsentContext.IsAdminConsent`.
Finally, `Add OAuth2PermissionGrant` writes the actual permission object into Entra’s directory (`DelegatedPermissionGrant.Scope`, `ConsentType = Principal` vs. `AllPrincipals`, and the ServicePrincipal `id`). When an administrator grants daemon Application Permissions rather than Delegated User scopes, `Add app role assignment to service principal` replaces `Add OAuth2PermissionGrant`.
Entra OAuth Audit Events Breakdown
| Audit Event Name | Scope Type | Key Forensic Field Inside ModifiedProperties |
|---|---|---|
| Add service principal | Directory Object Creation | AppId, ServicePrincipalNames, AppDisplayName |
| Consent to application | Consent Context & Actor | ConsentContext.IsAdminConsent, ConsentContext.IsAppOnly |
| Add OAuth2PermissionGrant | Delegated Permissions | DelegatedPermissionGrant.Scope, ConsentType |
| Add app role assignment to service principal | Application (Daemon) Permissions | AppRole.Value (e.g., Mail.ReadWrite, RoleManagement.ReadWrite.Directory) |
Forensic Telemetry Fields & High-Signal Indicators
| Telemetry Field / Pattern | Meaning in M365 / Entra | High-Signal Threat Indicator |
|---|---|---|
1. Add service principal | First time an external app enters the tenant | Provides AppId, ServicePrincipal ObjectId & DisplayName |
2. Consent to application | Captures interactive consent decision | Provides initiating User, ClientIP & IsAdminConsent |
3. Add OAuth2PermissionGrant | Persists delegated user/all-principal scopes | Lists exact Scope string (e.g., Mail.ReadWrite) |
4. Add app role assignment to SP | Grants app-only daemon permissions (no user needed) | Highest risk—tenant-wide read/write without logins |
correlationId | Shared GUID across all 3 consent steps | Use inside AuditVane Search to view full event group |
ConsentType = AllPrincipals vs. Principal | Tenant-wide vs. single-user scope | AllPrincipals exposes EVERY mailbox in the company |
Paired Add OAuth2PermissionGrant ModifiedProperties Record
{
"activityDateTime": "2026-12-02T14:15:09.180Z",
"activityDisplayName": "Add OAuth2PermissionGrant",
"category": "ApplicationManagement",
"correlationId": "c8812f10-44ab-49d1-8899-112233445566",
"targetResources": [{
"type": "ServicePrincipal",
"id": "sp-object-id-8812",
"modifiedProperties": [
{ "displayName": "DelegatedPermissionGrant.Scope", "newValue": "User.Read Mail.ReadWrite offline_access" },
{ "displayName": "DelegatedPermissionGrant.ConsentType", "newValue": "Principal" }
]
}]
}
Searching `c8812f10-44ab-49d1-8899-112233445566` inside AuditVane immediately binds this exact `DelegatedPermissionGrant.Scope` (`Mail.ReadWrite offline_access`) with the user IP from `Consent to application`.
Correlate Full Consent Chain by CorrelationId via Graph & KQL
// Sentinel KQL correlation:
AuditLogs
| where OperationName in ("Add service principal","Consent to application","Add OAuth2PermissionGrant","Add app role assignment to service principal")
| summarize Operations=make_set(OperationName), Actors=make_set(InitiatedBy.user.userPrincipalName), Targets=make_set(TargetResources) by CorrelationId
# PowerShell Graph filter:
Get-MgAuditLogDirectoryAudit -Filter "correlationId eq 'c8812f10-44ab-49d1-8899-112233445566'" | Select-Object ActivityDateTime, ActivityDisplayName, Category
Sample CorrelationId Event Bundle
ActivityDateTime ActivityDisplayName Category
---------------- ------------------- --------
2026-12-02T14:15:09.050Z Add service principal ApplicationManagement
2026-12-02T14:15:09.110Z Consent to application ApplicationManagement
2026-12-02T14:15:09.180Z Add OAuth2PermissionGrant ApplicationManagement
Real-World Incident Walkthrough
An analyst spots `Add OAuth2PermissionGrant` in a SIEM summary showing `Scope = User.Read Mail.ReadWrite`. On its own, `Add OAuth2PermissionGrant` sometimes obscures the consenting IP address inside system properties.
Dropping the Entra Audit JSON into AuditVane and filtering by that row’s `correlationId` pulls up the paired `Consent to application` event 80 milliseconds earlier—revealing both `hr.lead@contoso.invalid` and attacker proxy `194.26.135.210`.
Step-by-Step Triage, Containment & Verification
- Drop Entra Directory Audit JSON or Purview UAL CSV into AuditVane and click AV-005 alerts.
- Open any `Consent to application` or `Add OAuth2PermissionGrant` row and copy its `correlationId`.
- Filter AuditVane by that `correlationId` to inspect all paired events (service principal creation, actor IP, and final granted scopes) together.
- Check `ConsentType` and `IsAdminConsent` carefully—if `AllPrincipals` / `True`, audit the initiating admin account for compromise too.
- Extract the `ServicePrincipal` object ID (`sp-object-id-8812`) and remove both the permission grant and the enterprise app.
How to Verify Containment Completed Cleanly
- All three correlated OAuth audit events analyzed for actor IP, admin-consent scope, and exact Graph permissions.
- OAuth2PermissionGrant and ServicePrincipal deleted from Entra ID.
- Service Principal Sign-In logs checked for the same AppId.
Analyst Blind Spots, Licensing Quirks & False Positives
Do not panic blindly over benign `User.Read` consents (which only allow reading basic display name/profile), yet NEVER ignore `Mail.*`, `Files.*`, `Notes.*`, `Calendars.*`, or `Directory.*` scopes—especially paired with `offline_access`.
Remember that `Add app role assignment to service principal` creates app-only daemon access without any entry in `Get-MgOauth2PermissionGrant`—you must check `Get-MgServicePrincipalAppRoleAssignment` separately!
Frequently Asked Questions
Can an admin consent give an app access to every employee’s mailbox?
Yes! Admin consent (`ConsentType = AllPrincipals`) or an Application Role Assignment grants tenant-wide permissions across all users.
Where are granted scopes stored in Purview UAL CSV exports?
Inside AuditData.ModifiedProperties as ConsentContext.Scope or DelegatedPermissionGrant.Scope—which AuditVane flattens automatically.
What is the difference between Delegated permissions and App Role Assignments?
Delegated permissions act on behalf of a signed-in user (OAuth2PermissionGrant), while App Role Assignments act silently as a daemon app across the entire tenant.
Does AuditVane handle both Entra JSON and Purview CSV consent logs?
Yes—rule AV-005 evaluates both schemas seamlessly.