Join our Newsletter — 33% off our NHI Course
Home› Guides› Microsoft Graph API Security Guide: App Permissions, Consent…
Guide Cloud & Workload Identity

Microsoft Graph API Security Guide: App Permissions, Consent and Abuse Detection

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 4 December 2026 16 min read
On this page

Most Microsoft 365 data theft by applications comes down to one thing: an app holding a Microsoft Graph permission far broader than its job, with a credential nobody watches. Microsoft Graph is the single API in front of Entra ID, Exchange Online, SharePoint, OneDrive and Teams, so a tenant-wide application permission such as Mail.Read or Sites.ReadWrite.All reaches every mailbox or site in the organisation. This guide is for identity engineers, Microsoft 365 administrators and detection engineers who need to choose the narrowest Graph permission, scope application access to named mailboxes and sites, harden the credentials that apps use, and detect abuse in Graph activity logs. It goes deeper than the consent basics, which the Entra ID Applications and Consent Guide already covers, and focuses on the controls that are specific to Graph.

This is an independent guide from NHI Mgmt Group, based on Microsoft's public documentation as of December 2026. It is not sponsored or reviewed by Microsoft. Product features change, so confirm settings against Microsoft's current documentation.

Key takeaways

  • Application permissions are tenant-wide by default: Microsoft states that an app with an application permission can access any data that the permission is associated with, and only an admin can consent to it.
  • Scope before you grant: use Selected permissions for SharePoint and OneDrive, RBAC for Applications for Exchange Online, and resource-specific consent for Teams, rather than .All permissions.
  • Remove the tenant-wide grant when you scope: Exchange RBAC for Applications is additive, so a leftover Entra grant of Mail.Read cancels the mailbox scoping.
  • The credential is the identity: prefer managed identities, then federated credentials from trusted platforms, then certificates; Microsoft advises against client secrets and the app instance property lock protects the credentials on its service principals.
  • Graph activity logs close the visibility gap: they record every Graph request with AppId, ServicePrincipalId, IPAddress, RequestUri, Roles and Scopes, which is what you need to see what an app actually did.

How Graph authorisation works

Every Graph call carries an access token. What that token can do depends on which of two permission types was granted and on what else the app has been given outside Graph permissions.

AspectDelegated permissions (scopes)Application permissions (app roles)
Who is presentA signed-in user; the app acts on their behalfNo user; the app acts as itself, usually via the client credentials flow
Effective accessThe intersection of the granted permission and the user's own rightsEverything the permission covers across the tenant, unless scoped by a resource-side control
Token claimscp (shown as Scopes in Graph activity logs)roles (shown as Roles in Graph activity logs)
Who can consentUsers (if consent policy allows) or adminsAdmins only
Typical useInteractive apps, add-ins, user-facing agentsDaemons, integrations, backup, migration, security tooling

Permission names follow the pattern {resource}.{operation}.{constraint}. The constraint matters most for security. Microsoft documents values including All, AppFolder, OwnedBy, Selected, Shared and Hidden; when no constraint is shown, access defaults to data owned by the signed-in user. Application.ReadWrite.OwnedBy, for example, lets an app manage only the applications it creates or owns, while Application.ReadWrite.All lets it manage every app registration.

Microsoft also notes that an app's effective privileges can come from outside its Graph permissions: from owning the resource it manages, or from an Entra RBAC or custom administrative role assigned to the service principal. A permission review that only reads the API permissions blade misses those paths. The App Registration vs Service Principal guide explains where each of these grants lives.

Choosing the narrowest permission

Microsoft's guidance is direct: grant the minimum permission the operation needs, review periodically for a less privileged option, and prefer delegated access over app-only access whenever it meets the requirement. In practice that means working through a short ladder for every request.

  1. Can it be delegated? If a user is present (an add-in, a user-facing assistant), delegated access caps the app at the user's own rights.
  2. Is there a Selected or OwnedBy constraint? For SharePoint and OneDrive, Selected permissions. For managing app registrations, Application.ReadWrite.OwnedBy instead of .All.
  3. Can the workload be scoped on the resource side? Exchange RBAC for Applications for mail and calendars; resource-specific consent for Teams chats and channels.
  4. Is Read enough? Many integrations request ReadWrite by habit. Check the least privileged permission listed on each API reference page.
  5. Only then, a tenant-wide .All permission, with a named owner, a business justification and a review date.

Permissions that warrant extra scrutiny include Directory.ReadWrite.All, Directory.AccessAsUser.All and Directory.Read.All (Microsoft lists these as higher-privilege options to use with caution), plus any permission that can change identities or grants, such as Application.ReadWrite.All, AppRoleAssignment.ReadWrite.All and RoleManagement.ReadWrite.Directory. To find what is already granted in your tenant, follow How to find high-privilege Microsoft Graph application permissions.

Scoping application access to specific resources

Three Microsoft mechanisms turn a tenant-wide application permission into access to named resources. They work differently, so the table summarises each before the detail.

WorkloadMechanismHow the scope is setKey caveat
SharePoint sites, lists, filesSelected permissions: Sites.Selected, Lists.SelectedOperations.Selected, ListItems.SelectedOperations.Selected, Files.SelectedOperations.SelectedConsent to the scope, then grant a role (read, write, owner, fullcontrol) on the resource via the Graph permissions endpointConsent alone grants nothing; granting at site level needs Sites.FullControl.All, so keep that granting app separate and tightly held
Exchange Online mail, calendars, contactsRBAC for ApplicationsAssign an application role (for example Application Mail.Read) with a management scope or an administrative unit scopeAdditive to Entra grants: remove the unscoped Entra permission or scoping has no effect
Teams chats, channels, meetingsResource-specific consent (RSC)An authorised user grants the app access to a specific team or chatSupported only for a subset of Graph features

SharePoint and OneDrive: Selected permissions

With Selected scopes, Microsoft documents three steps that must all be completed: consent to the scope in Entra ID, grant the app a role on the specific site, list, item or file (for example POST /sites/{siteId}/permissions with "roles": ["read"]), and acquire a token containing the scope. An app consented to Lists.SelectedOperations.Selected initially has no access at all. Assigning app permissions to lists, items, folders or files breaks inheritance on that resource, so record each assignment in your app inventory. Revoking the scope consent in Entra ID blocks the app from every resource it was granted.

Exchange Online: RBAC for Applications

RBAC for Applications replaces Application Access Policies. The workflow, as documented by Microsoft, is: create a pointer to the existing Entra service principal with New-ServicePrincipal, define the scope with New-ManagementScope (a recipient filter) or use an administrative unit, assign the role with New-ManagementRoleAssignment, and check the outcome with Test-ServicePrincipalAuthorization against a target mailbox. Microsoft recommends the native administrative unit parameter on the role assignment rather than a scope that points at an administrative unit.

The critical step is removal. Microsoft's own example: if the app keeps Mail.Read granted in Entra ID and you add a resource-scoped Mail.Read in Exchange, the union of the two gives no effective scoping. Test-ServicePrincipalAuthorization also excludes permissions granted separately in Entra ID, so a clean test result does not prove the tenant-wide grant has gone. Check both places. Pay particular attention to roles such as Application EWS.AccessAsApp, which Microsoft describes as full access to all mailboxes through Exchange Web Services.

Unscoped mailbox access through an application is the pattern behind the Microsoft Midnight Blizzard breach, where the attacker used a forgotten test OAuth app to grant itself the Exchange Online full_access_as_app role and read mailboxes without signing in as each user.

Hardening the credentials apps use against Graph

An application permission is only as safe as the credential that obtains the token. Microsoft's app registration best practices set a clear order of preference.

Credential optionMicrosoft guidanceWhere it fits
Managed identityUse whenever possible; described as the most secure option with no ongoing credential managementWorkloads running in Azure
Federated identity credentialAcceptable with caution; configure only platforms you trust, because the app is only as secure as that platformCI/CD (for example GitHub Actions), Kubernetes, other clouds
CertificateUse when managed identities are not possible; store in a key vault such as Azure Key Vault; prefer CA-issuedOn-premises daemons, third-party hosting
Client secret (password credential)Microsoft says not to use them; limit or block with application management policiesAvoid; migrate existing ones

Further controls from the same guidance and related Microsoft pages:

  • App instance property lock: lets the app lock sensitive properties on its service principals against modification: credentials used for verification, credentials used for signing tokens, and the token encryption key ID. Microsoft states that since June 2026 the Enable property lock setting is on by default for new applications. Review older apps under App registrations, Authentication, App instance property lock, and set All properties where nothing needs to change.
  • Owners: keep app owners to a minimal set and review the list every few months. An owner can add a credential and then act as the app with every permission it holds. See How to find Entra apps and service principals with no owner.
  • Administrative roles: Application Administrator and Cloud Application Administrator are marked privileged in Microsoft's role reference because they can manage all aspects of app registrations and enterprise apps. Treat them as you would Privileged Role Administrator and put them behind PIM.
  • Redirect URIs: keep ownership of every URI, no wildcards, no http or URN schemes, and trim the list.
  • Unused credentials: Microsoft warns that an unused credential on an application can lead to a breach. Remove expired and unused keys and secrets.

The Azure Managed Identities Security Guide and How to audit Entra workload identity federated credentials cover those two options in depth.

Conditional Access for workload identities: lets you block a service principal's token requests from outside named locations or when Entra ID Protection reports service principal risk. Block is the only grant control. Microsoft scopes it to single-tenant service principals registered in your tenant: multitenant SaaS apps and managed identities are not covered, and a policy assigned to a group containing a service principal is not enforced for it, so assign each workload identity directly. Workload Identities Premium licences are needed to create or modify these policies. Start in report-only mode and read the results in the sign-in logs before turning the policy on. See Conditional Access for Workload Identities.

User consent: by default, Microsoft states that all users can consent to apps for permissions that do not need admin consent. Microsoft recommends allowing user consent only for apps from verified publishers; the matching built-in policy is microsoft-user-default-low, which also requires you to classify which permissions are low impact. Changing the setting affects only future consent; existing grants stay until you remove them. The step-by-step is in How to restrict user consent to apps in Entra ID, and illicit grant patterns are covered in the Consent Phishing and Illicit OAuth Grants Guide.

Where identity fits

Every Graph integration is a non-human identity: a service principal with a credential and a set of permissions, often outliving the project that created it. Apply the same lifecycle you use for any NHI: a named human owner, a documented purpose, a review date and decommissioning when the purpose ends. AI agents and Copilot extensions that call Graph are no different; if they act for a user, use delegated permissions so the agent cannot exceed that user's rights. The Microsoft Graph API for Beginners page introduces these ideas for newcomers.

Implementation: a phased rollout

  1. Inventory (weeks 1 to 2): export every service principal with Graph application permissions, its credential types and expiry, owners, and any Entra or Exchange role assignments. Tag each with an owner and purpose.
  2. Turn on visibility: send Microsoft Graph activity logs and service principal sign-in logs to Log Analytics or your SIEM before changing anything, so you have a baseline of which apps call which endpoints.
  3. Pick the pilot: two or three internal apps with Mail.Read or Sites.Read.All that only touch a few mailboxes or sites. Use the baseline to confirm which resources they really read.
  4. Scope in parallel: add the RBAC for Applications assignment or Selected permission grant while the tenant-wide permission still exists. Test with Test-ServicePrincipalAuthorization and with real calls against an in-scope and an out-of-scope resource.
  5. Remove the broad grant: revoke the tenant-wide Entra consent. Confirm the out-of-scope call now returns 403 in the Graph activity logs. Rollback is re-granting admin consent for the original permission, which takes effect when the app gets a new token.
  6. Harden credentials: migrate secrets to managed identities, federated credentials or certificates; enable the property lock; set an application management policy that limits secret lifetimes for new apps.
  7. Constrain: add workload identity Conditional Access in report-only mode, review a week of results, then enforce.
  8. Govern: require the permission ladder in every new app request and review high-privilege grants quarterly.

Decision guidance

  • Delegated versus application: choose delegated whenever a user is present; choose application only for unattended workloads, then scope it.
  • RBAC for Applications versus Application Access Policies: new work should use RBAC for Applications, which Microsoft says replaces the older policies; migrate existing policies by pointing a management scope at the same group with a MemberOfGroup filter (nested members are not included).
  • Selected permissions versus a dedicated tenant: Selected permissions suit most integrations. Where a vendor insists on tenant-wide access, contract and monitor, or isolate the data.
  • Small organisations: focus on the inventory, consent restrictions, removing secrets and turning on Graph activity logs. Workload identity Conditional Access needs extra licensing, so prioritise it for the handful of apps with the broadest permissions.
  • Large organisations: use administrative units to align Exchange scoping with business units, automate the inventory, and route every new Graph application permission through a review board.

Detection and measurement

Microsoft Graph activity logs record HTTP requests the Graph service receives for your tenant, including requests from line-of-business apps, SDKs, AI clients and Microsoft apps. They need an Entra ID P1 or P2 licence and a diagnostic setting (Security Administrator is the least privileged role that can configure it). Microsoft says events usually arrive within 30 minutes and occasionally up to 2 hours. Join them to sign-in logs on SignInActivityId = UniqueTokenIdentifier to tie a call to the token request that produced it. Detail queries live in Microsoft Graph Activity Logs and Microsoft Graph Exfiltration Detection.

SignalSourceWhy it matters
Credential added to an application or service principalEntra audit logPersistence through extra app credentials (ATT&CK T1098.001)
App role assignment or admin consent to a high-privilege Graph permissionEntra audit logNew tenant-wide access (T1098.003 where a role is added)
App calling mail endpoints such as /users/{id}/messages across many mailboxesGraph activity logs (RequestUri, ServicePrincipalId)Remote email collection (T1114.002)
Service principal token use from a new IP or countryService principal sign-in logs, Graph activity logs (IPAddress)Stolen application token or credential (T1528, T1550.001)
Spike in 403 responses for one appGraph activity logs (ResponseStatusCode)Probing beyond scope, or a broken app after scoping
Enumeration of users, groups or role assignmentsGraph activity logsCloud account discovery (T1087.004)

Metrics that show the programme is working:

  • Number of service principals holding tenant-wide mail, files or directory write permissions, trending down.
  • Percentage of Exchange and SharePoint integrations scoped with RBAC for Applications or Selected permissions.
  • Percentage of apps with Graph application permissions that use a client secret (target zero).
  • Percentage of high-privilege apps with at least one named, active owner and a review in the last 90 days.
  • Median time from a high-privilege consent event to review by the identity team.

Common failure patterns

  • Scoping that does not scope: an Exchange management scope added while Mail.Read stays granted in Entra ID. The app still reads every mailbox.
  • Forgotten test and legacy apps: a proof of concept granted broad permissions in a production tenant and never removed, as in the Microsoft Midnight Blizzard breach.
  • Owner as a back door: a departed developer remains an app owner and can add a secret to an app holding Directory.ReadWrite.All.
  • Granting app over-reach: the automation that assigns Sites.Selected roles holds Sites.FullControl.All and is itself poorly protected.
  • Group-assigned workload Conditional Access: the policy targets a group of service principals and is silently not enforced.
  • Blind spots in logs: relying on audit logs alone, which show grants but not what data an app read afterwards.

Framework mapping

Control areaNIST SP 800-53 Rev 5NIST CSF 2.0MITRE ATT&CK
Least privilege Graph permissions and resource scopingAC-6, AC-3PR.AA-05T1114.002, T1530
App inventory, owners and lifecycleAC-2PR.AA-01T1098.003
App credential managementIA-5PR.AA-01T1098.001, T1528
Graph activity and sign-in loggingAU-12, AU-6DE.CM-03T1550.001, T1087.004

Practitioner checklist

  • Inventory every service principal with Graph application permissions, its credentials, owners and Entra or Exchange role assignments.
  • Apply the permission ladder: delegated, constrained (Selected, OwnedBy), resource-scoped, Read, then .All only with justification.
  • Scope Exchange access with RBAC for Applications and remove the matching tenant-wide Entra grant.
  • Use Selected permissions for SharePoint and OneDrive, and protect the app that holds Sites.FullControl.All.
  • Replace client secrets with managed identities, trusted federated credentials or certificates in a key vault.
  • Enable the app instance property lock on existing apps; keep owners minimal and reviewed.
  • Restrict user consent to verified publishers and low-impact permissions.
  • Assign workload identity Conditional Access directly to high-privilege single-tenant service principals, report-only first.
  • Stream Graph activity logs and service principal sign-in logs to your SIEM and alert on the signals above.

Standards and references

Related NHI Mgmt Group resources: Entra ID Applications and Consent Guide, How to find high-privilege Microsoft Graph application permissions, Microsoft Graph Activity Logs, Conditional Access for Workload Identities.

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.