Playbook: suspicious OAuth application consent
Capture the application and grant, disable access, find affected data and users, and prevent the same consent path from recurring.
Scope
For identity and cloud teams responding to an unfamiliar Entra enterprise application or permission grant.
Start with the situation, not the slogan
A playbook is a decision aid for tired people working with incomplete information. Playbook: suspicious OAuth application consent therefore names owners, evidence, containment and exit criteria instead of pretending every incident follows a flowchart. Read it before the incident, tailor the contacts and systems, and exercise the awkward branches.
The first objective is shared situational awareness: what is known, who owns the incident, what business process is at risk, and which decision is due next. A chat channel full of competent people is not the same as command. Assign a coordinator and a note taker, even when the organisation is small enough for both to use the same kettle.
Application tokens and permissions can survive password changes and operate through APIs. Scope depends on consent type, permissions, users, credentials, and observed use.
Composite scenario
How this usually reaches the desk
The playbook should activate when the team can establish its entry conditions, including: Application ID, service principal, publisher, owners, credentials, permissions, and consent type are recorded. If the report remains ambiguous, open a low-severity record and time-box validation rather than ignoring it or declaring the end of civilisation. Escalate as evidence, privilege, spread or business impact increases.
This scenario combines common operational patterns; it is not presented as a report of one named incident.
What to look for
Begin with preserved, comparable evidence. One signal is rarely proof; use independent observations and a reliable timeline before declaring scope or intent.
Application ID, service principal, publisher, owners, credentials, permissions, and consent type are recorded.
Confirm this condition from an authoritative source and note who supplied it. Mark assumptions as assumptions; they have an unfortunate habit of becoming facts in copied status updates.
Audit and sign-in logs for the app and affected users are available.
Identify the decision that depends on the information and the deadline for obtaining it. Evidence is most useful when it changes action rather than merely decorating the timeline.
The business owner or expected integration purpose can be independently verified.
Check coverage and retention before containment. If a source is unavailable, record the gap and use independent evidence rather than silently treating absence as innocence.
Working examples
Run it, read it, decide what changes
These examples use documentation addresses, test identities and bounded targets. Replace placeholders only inside systems you own or are explicitly authorised to operate. Read the expected result and next action before running the command; a successful command is evidence, not yet a conclusion.
Inventory OAuth grants for one user
- Prerequisites
- Graph PowerShell and `DelegatedPermissionGrant.ReadWrite.All` or an equivalent approved read role.
Connect-MgGraph -Scopes "DelegatedPermissionGrant.ReadWrite.All","Application.Read.All"
$user = Get-MgUser -UserId "alex@example.com"
Get-MgOauth2PermissionGrant -Filter "principalId eq '$($user.Id)'" |
Select-Object Id,ClientId,ResourceId,Scope,ConsentTypeThe output lists consent grant identifiers, client applications, resources and scopes.
Broad scopes such as mail or file access deserve an owner and business purpose. The client ID must be resolved to a service principal before judging the application.
Export the grants, resolve each client with `Get-MgServicePrincipal -ServicePrincipalId`, and remove only grants confirmed unauthorised through the supported Graph removal operation.
List service principals created in the review window
- Prerequisites
- Graph PowerShell, `Application.Read.All`, and a recorded UTC start time.
Connect-MgGraph -Scopes "Application.Read.All"
Get-MgServicePrincipal -All |
Where-Object {$_.CreatedDateTime -ge [datetime]"2026-08-18T08:00:00Z"} |
Select-Object DisplayName,AppId,Id,CreatedDateTime,AccountEnabledApplications created after the stated time are listed.
Creation time narrows the review but does not prove maliciousness. Pre-existing applications can receive new grants later.
Compare app owners, publisher verification, reply URLs, credentials and audit logs with the approved SaaS inventory.
Prove a consent grant is gone
- Prerequisites
- The recorded grant ID and permission to read grants.
$grantId = "00000000-0000-0000-0000-000000000000"
Get-MgOauth2PermissionGrant -OAuth2PermissionGrantId $grantId -ErrorAction SilentlyContinueNo object is returned after a successful removal; an existing object is printed if the grant remains.
Absence of one grant does not remove application credentials, other tenants, app-role assignments or stolen tokens.
Recheck service-principal assignments, revoke affected user sessions, and test that the application can no longer call the protected resource.
Response sequence
Read the whole sequence before starting. Several workstreams may run in parallel, but their evidence, authority and expected outcomes still need to be explicit. Every step below points back to a concrete example; use the example as implementation evidence, not as permission to operate outside the stated scope.
Operational judgement
Run the playbook as a checklist with judgement, not as a spell. For OAuth, Playbook and Entra ID, localise tenant names, log locations, provider contacts, legal thresholds, emergency credentials and business priorities. A generic document becomes operational only when the people on duty can find the required access without consulting the person currently on holiday.
Use a decision log separate from the task list. For each consequential action, note time, owner, evidence, choice, expected effect and observed result. This gives later reviewers something better than a reconstructed story and helps the next shift understand why a seemingly obvious action was delayed or rejected.
Handover
Make the result useful to the next person
Prepare the playbook package before an incident: primary and deputy owners, current contact routes, system inventory, evidence locations, delegated authority, provider escalation, legal and privacy triggers, secure communication, and emergency credentials. Keep a printable or otherwise independent copy where an identity or collaboration outage cannot hide it. Review contact details during exercises; telephone numbers appear to age faster than almost any cryptographic primitive.
For this playbook, the incident record should open with “Declare the incident and preserve the app’s complete configuration, grant, sign-in, and audit evidence.” and drive deliberately towards “Restore only approved integration, then harden consent policy, ownership, credentials, and alerts.” A shift handover must state confirmed facts, open hypotheses, business impact, containment already applied, evidence at risk, approvals pending and the next scheduled update. After closure, turn lessons into owned changes to controls, documentation and exercises. A lesson without an owner and a date is simply a well-written regret.
Validate before you close
Exit when malicious access is invalid, data impact is assessed, related identities are handled, and future equivalent grants require a controlled approval path.
Capture the test, the expected result and the observed result. Where a person or business owner must accept restored service, name them in the record. A green dashboard can confirm that a component is answering; it cannot confirm that invoices, identities or restored data are trustworthy.
Finish with a compact closure note: the original trigger, confirmed scope, evidence retained, controls changed, tests passed, known gaps, residual risk, and the people responsible for the remaining work. Schedule a review while the timeline is still fresh enough to challenge. The purpose is not to find a person to blame; computers already perform blame with admirable efficiency. The purpose is to make the next response faster, safer and less dependent on one person remembering where the useful log was hidden.
Common mistakes
- Running the playbook without assigning a decision owner and note taker.
- Containing too early or too late because evidence and business impact were not compared.
- Closing the incident without documenting recovery checks and follow-up owners.
These errors usually come from haste, unclear ownership or misplaced confidence. Build the safeguard into the runbook: a required evidence field, a second-person review, a rollback test or a specific exit criterion.
Questions people ask when the clock is running
Who may activate the playbook?
Define that locally before an incident. Help desk or monitoring staff should be able to open a record and escalate; containment authority may sit with incident command, service ownership or an executive depending on impact.
Must every step be completed in order?
No. Evidence, containment, communication and recovery often run in parallel. Keep dependencies explicit and do not let a later checkbox imply that an earlier decision was actually verified.
What is the exit condition?
Exit when malicious access is invalid, data impact is assessed, related identities are handled, and future equivalent grants require a controlled approval path. Residual risk, communication and improvement actions still need named owners even after service is restored.
Safety boundary
Use these steps only on systems you own or are explicitly authorised to assess. Preserve evidence, follow your organisation’s legal and regulatory obligations, and prefer reversible actions when the situation is not yet understood.
Primary references
- View Activity Logs of Application PermissionsMicrosoft Learn
- Revoke User Access in an EmergencyMicrosoft Learn
- SP 800-61 Rev. 3: Incident Response Recommendations and ConsiderationsNIST
- Microsoft Graph PowerShell OverviewMicrosoft Learn
Editorial status: first edition. Review the linked vendor documentation for product- and version-specific changes before acting.