OAuth & Identity Persistence · T1528 / T1098.001

Consent to Application vs. Add OAuth2PermissionGrant: Log Correlation Guide

Direct Answer (Key Forensic Takeaway)

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`.

1. RAW TELEMETRY OAuth & Identity Persistence T1528 / T1098.001 2. CLIENT-SIDE PARSE AuditVane Engine Consent to application Add OAuth2P 0 Bytes Uploaded 3. SOC OUTCOME Scoped Containment IOCs · CSV · KQL
Local browser DFIR workflow for Consent to application Add OAuth2PermissionGrant (T1528 / T1098.001)
AdSense-Ready In-Article Placement

Entra OAuth Audit Events Breakdown

Audit Event NameScope TypeKey Forensic Field Inside ModifiedProperties
Add service principalDirectory Object CreationAppId, ServicePrincipalNames, AppDisplayName
Consent to applicationConsent Context & ActorConsentContext.IsAdminConsent, ConsentContext.IsAppOnly
Add OAuth2PermissionGrantDelegated PermissionsDelegatedPermissionGrant.Scope, ConsentType
Add app role assignment to service principalApplication (Daemon) PermissionsAppRole.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 principalFirst time an external app enters the tenantProvides AppId, ServicePrincipal ObjectId & DisplayName
2. Consent to applicationCaptures interactive consent decisionProvides initiating User, ClientIP & IsAdminConsent
3. Add OAuth2PermissionGrantPersists delegated user/all-principal scopesLists exact Scope string (e.g., Mail.ReadWrite)
4. Add app role assignment to SPGrants app-only daemon permissions (no user needed)Highest risk—tenant-wide read/write without logins
correlationIdShared GUID across all 3 consent stepsUse inside AuditVane Search to view full event group
ConsentType = AllPrincipals vs. PrincipalTenant-wide vs. single-user scopeAllPrincipals 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

  1. Drop Entra Directory Audit JSON or Purview UAL CSV into AuditVane and click AV-005 alerts.
  2. Open any `Consent to application` or `Add OAuth2PermissionGrant` row and copy its `correlationId`.
  3. Filter AuditVane by that `correlationId` to inspect all paired events (service principal creation, actor IP, and final granted scopes) together.
  4. Check `ConsentType` and `IsAdminConsent` carefully—if `AllPrincipals` / `True`, audit the initiating admin account for compromise too.
  5. 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.

Related Forensics Guides