Monday Number Book a call

msp/oauth-app-audit-microsoft-365

OAuth app audit in Microsoft 365: every grant, in one list.

An OAuth app audit lists every app that holds access to a client's tenant, and what it can reach. Microsoft 365 has two kinds of grant. Delegated grants act as a user. Application grants act with no user at all. Export both with Graph PowerShell, flag the risky scopes, then read the consent log.

This page is for MSP owners and techs who run the audit by hand. For the other places AI hides, read how to find shadow AI in a client tenant.

oauth/grants2 kinds
The two kinds of grant you export
  • Delegated: the app acts as a signed-in user. Stored as an oAuth2PermissionGrant.
  • Application: the app acts alone, with no user. Stored as an app role assignment.
  • AllPrincipals: someone granted a delegated app access for every user.

Microsoft says any delegated grant implies offline_access, so the app keeps access. Go to the self-check.

msp/what-people-say

What MSPs and IT teams say about app grants.

From 7,558 posts and comments we read in threads about AI on r/msp, r/sysadmin, r/ITManagers and Spiceworks. These lines are paraphrased.

In short

  • Does anyone have a way to see every agent or integration with tenant access?
  • We removed the enterprise apps and blocked self-registration. The note-takers still join.
  • User consent grants stay behind after you delete the enterprise app.
  • Before anyone talks Copilot, pull the enterprise app consent grants in Entra.
  • These AI tools never show up in your identity provider or single sign-on.
  • We want an admin switch for which connections Claude is allowed to make.

The pattern: the grants are in the tenant already. Few people export the full list.

msp/what-goes-wrong

What goes wrong with app grants.

  1. Revoke, then the user grants it againMicrosoft says revoking a grant does not stop users from consenting again. If user consent is still open, the note-taker is back next week.
  2. The portal shows one app at a timeEnterprise applications shows each app's Admin consent and User consent tabs. You cannot revoke User consent grants there. You need Graph or PowerShell, so most people never do.
  3. One click, every mailboxAn application grant such as Mail.Read lets the app read mail in all mailboxes, with no signed-in user. Microsoft notes that a password reset or MFA does not remove a bad grant.
  4. A user grants their whole file storeBy default, users can consent to permissions that need no admin consent. Delegated Mail.Read and Files.Read.All are in that group. One click gives an AI app that user's mail or every file they can open.
  5. The log is gone before you lookMicrosoft keeps Entra audit logs for seven days on Entra ID Free, and 30 days on P1 or P2. A consent from last quarter is not in the Entra log any more.

msp/self-check

Check yourself: eight questions.

Answer yes or no for one client tenant. Every no links to the step that fixes it.

  1. 1Have you exported every delegated grant in the tenant to one file? If no, step 1.
  2. 2Do you know which delegated grants are AllPrincipals, so they cover every user? If no, step 1.
  3. 3Have you exported the application permissions held by non-Microsoft apps? If no, step 2.
  4. 4Have you flagged every grant that can read mail, files, sites or calendars? If no, step 3.
  5. 5Do you read the consent log on a schedule, before it expires? If no, step 4.
  6. 6Is user consent off, or limited to verified publishers and low-impact permissions? If no, step 5.
  7. 7Is the admin consent workflow on, so users can ask instead of going round you? If no, step 5.
  8. 8When you revoke a grant, do you record the app, the scopes, the owner and the reason? If no, step 6.

Count the noes. Each one is an app that can read client data without anyone on your side knowing.

msp/this-week

What to do this week.

Six steps. You can do all of them without us. None needs a licence beyond Microsoft 365.

  1. Step 1. Export the delegated grantsInstall the Microsoft Graph PowerShell SDK. Sign in with Connect-MgGraph -Scopes "Directory.Read.All","Application.Read.All" with the Directory Readers or Cloud Application Administrator role. Run Get-MgOauth2PermissionGrant -All | Select-Object Id,ClientId,ConsentType,PrincipalId,ResourceId,Scope | Export-Csv grants.csv -NoTypeInformation. ClientId is the object ID of the app's service principal. ConsentType is AllPrincipals for every user, or Principal for one user, named in PrincipalId. Scope is the list of permissions. Look up each app name with Get-MgServicePrincipal -ServicePrincipalId <ClientId>.
  2. Step 2. Export the application permissionsApplication permissions are app role assignments on the app's own service principal. For each app you do not recognise, and every AI app, run Get-MgServicePrincipalAppRoleAssignment -ServicePrincipalId <id> -All. Each row has an AppRoleId and a ResourceDisplayName, such as Microsoft Graph. Match the AppRoleId to a permission name in the AppRoles list of that resource.
  3. Step 3. Flag the risky scopesSort by scope, not by app name. Flag these first. Mail.Read: delegated reads the user's mailbox, application reads all mailboxes. Files.Read.All: delegated reads every file the user can open, application reads all site collections. Sites.Read.All and Mail.Send next. Any delegated grant also carries offline_access, so the app keeps refreshing its tokens. Microsoft's own advice: review every non-Microsoft app with AllPrincipals, and any scope with Read, Write or All in it.
  4. Step 4. Read the consent logIn the Microsoft Entra admin center, go to Entra ID, then Enterprise apps, then Audit logs under Activity. Filter on the category ApplicationManagement. The activities are “Consent to application”, “Add delegated permission grant” and “Add app role assignment to the service principal”. For an older window, search the Purview audit log in the Defender portal for “Consent to application”. Check if IsAdminConsent is True. Read it every week on Entra ID Free, and every month on P1 or P2, or it expires.
  5. Step 5. Close consent before you revokeIn the Entra admin center, go to Enterprise apps, then Consent and permissions, then User consent settings. Choose “Do not allow user consent”. Or choose “Allow user consent for apps from verified publishers, for selected permissions”, then classify which permissions are low impact. Turn on the admin consent workflow, so users can ask you. Settings changes do not touch existing grants. Our page on a client who wants Claude shows how to approve one AI app properly.
  6. Step 6. Revoke, and write it downRemove a delegated grant with Remove-MgOauth2PermissionGrant -OAuth2PermissionGrantId <Id>. Remove an application permission with Remove-MgServicePrincipalAppRoleAssignment. You can revoke Admin consent grants in the portal from the app's Permissions page. Sign in with write scopes only for this step. Record the app, scopes, owner, date and reason, and tell the user before their tool stops.

Settings move often. We checked these steps against Microsoft Learn pages for Entra ID, Microsoft Graph and Defender for Office 365 on 29 October 2026.

What we do.Our free scan exports both kinds of grant for one client tenant and flags the ones that reach mail and files. You get it on a page under your name by Friday. We read grants and names, never mail or file content. After that we run your clients' AI under your name, at £28 per AI user a month wholesale.

Get a free scan of one client

msp/questions

Questions MSPs ask about OAuth app audits.

What is the difference between delegated and application permissions?

A delegated permission lets an app act as a signed-in user, and reach only what that user can reach. An application permission lets the app act on its own, with no user, across the tenant. Application permissions always need an admin to grant them. Delegated ones often do not.

Can a user give an AI app access to their files without an admin?

Yes, by default. Microsoft lets users consent to permissions that do not need admin consent. Delegated Files.Read.All and Mail.Read are in that group. Change the user consent setting in Entra to stop it, and turn on the admin consent workflow.

Does revoking a grant stop the app for good?

No. Microsoft says revoking a grant does not stop users from consenting to the app again. Close or limit user consent first, then revoke. Check the consent log the next week to see if it came back.

Do I need app governance or E5 for an OAuth audit?

No. Graph PowerShell and the Entra audit log work without an extra licence. App governance is part of Defender for Cloud Apps. If the client has that licence, it adds one dashboard of OAuth apps, their permissions and their users, plus policies and alerts.

How often should we run an OAuth app audit?

Microsoft suggests a weekly review of consent grants for tenants with many apps and users. For a small client firm, we export the full list each quarter and read the consent log each month, before it expires.

msp/start

Start with one client.

By Friday: every app grant in one client's tenant, with the risky scopes flagged, on a page under your name. Then decide.

Written by David Stubbs. Last checked: 29 October 2026. More for MSPs: shadow AI in client tenants and whether to block ChatGPT or allow it.