Lesson 2 of 3 Application and Workload Identities

Managing OAuth Permission Grants and Consent

This lesson explains permission types, consent settings and the review workflow, and why consent is an attack route.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish delegated from application permissions.
  • Explain how a consent phishing attack works.
  • Choose a user consent setting.
  • Describe the admin consent workflow.

How OAuth consent works

OAuth 2.0 lets an application obtain limited access to a resource without learning the user's password. The application asks for permissions, called scopes, such as Mail.Read for Microsoft Graph. Someone must agree, and that agreement is consent. The record of that agreement is an OAuth permission grant, which is attached to the application's service principal.

There are two kinds of permission, and the difference is central to this topic.

Delegated permission
Acts asThe application on behalf of a signed-in user
Effective accessThe overlap of the permission and what the user can do
Who can consentA user, if settings allow and the permission is low risk, or an administrator
Typical useAn interactive web or mobile application
Application permission
Acts asThe application itself, with no user
Effective accessThe whole permission, across the tenant
Who can consentAn administrator only
Typical useA background service or daemon

The effective access of a delegated permission can never exceed the user's own rights, which is an important limit. An application permission such as Mail.Read as an application role, by contrast, can read every mailbox in the tenant, which is why only an administrator can grant it.

The following diagram shows the consent flow and the effective access of each permission type.

How OAuth consent works and why the permission type matters. An application asks for permissions, called scopes. When someone consents, an OAuth permission grant is attached to the application's service principal. A delegated permission lets the application act on behalf of a signed-in user, so its effective access is the overlap of the permission and the user's own rights. An application permission lets it act as itself across the whole tenant, so only an administrator can grant it.
Application permissions are tenant-wide, so only administrators grant them.
Sort into groups

Delegated or application permission?

Exam skills 1.1.5

Decide which kind of permission each statement describes.

Log in to try this activity Interactive activities are free with an account.

Illicit consent attacks

Attackers no longer need a password if a user can be persuaded to grant an application access. In a consent phishing attack, a user receives a link to a real Microsoft sign-in page, and the page shows a real consent prompt for an application controlled by the attacker. When the user agrees, the application receives a token for that user's data. Multifactor authentication does not help, because the user is really signing in, and the attacker's access continues after a password reset, because the grant remains in place.

Removing the grant is therefore an essential part of responding to such an incident. Revoke the permissions on the enterprise application or delete its service principal, review the audit logs for the consent event, and revoke the user's refresh tokens.

Troubleshooting scenario

The consent phishing incident

Exam skills 1.1.5

Respond to an illicit consent grant.

Log in to try this activity Interactive activities are free with an account.

User consent settings

Tenant settings under Enterprise applications > Consent and permissions decide what users may consent to. By default, users can consent to permissions that do not need administrator consent, which is too broad for most organizations. The options are as follows.

SettingEffectSuitability
Do not allow user consentAll consent needs an administratorThe strictest option; it needs a working request process.
Allow user consent for apps from verified publishers, for selected permissionsUsers can consent only to low-impact permissions, for publishers verified by MicrosoftThe recommended balance. The policy ID is microsoft-user-default-low.
Allow user consent for appsUsers can consent to any application for permissions that need no admin consentThe legacy behaviour, which leaves the most room for abuse.

Permission classifications let an administrator decide which permissions count as low impact, and Microsoft recommends beginning with basic sign-in permissions such as User.Read. Configuring these settings needs the Privileged Role Administrator role.

The admin consent workflow

Blocking user consent without an alternative leaves users stuck, and it encourages them to look for workarounds. The admin consent workflow gives them a route: when a user cannot consent to an application, the user can submit a request with a justification, and designated reviewers receive it.

A Global Administrator turns on the setting Users can request admin consent to apps they are unable to consent to, chooses who can review requests, and decides whether to send email notifications and reminders, and when requests expire. The feature can take up to an hour to become active. Reviewers can approve within their own rights, or block or deny a request. Only a Global Administrator can approve Microsoft Graph application permissions, because of their reach.

  1. Request

    A user encounters a prompt that needs approval and sends a request with a reason.

  2. Review

    A reviewer examines the publisher, the permissions and the business need.

  3. Decide

    The reviewer approves, denies, or blocks the application so that nobody can request it again.

  4. Audit

    The decision appears in the audit logs, and the user receives a notification.

True or false

Admin consent workflow

Exam skills 1.1.5

Check how the admin consent workflow works.

Log in to try this activity Interactive activities are free with an account.

Reviewing existing grants

Controlling new consent does not remove what has already been granted. A periodic review should list enterprise applications, sort them by high-risk permissions, and check each one against a business owner. The Permissions tab on an enterprise application shows delegated and application permissions, separated by admin consent and user consent. Application permissions in categories such as mail, files and directory write deserve the closest attention. App governance in Microsoft Defender for Cloud Apps can add behavioural monitoring and alerts on unusual activity by OAuth applications.

Worked example

Closing a consent gap

A security review finds that several employees granted an unknown third-party application access to read their mail. The company must prevent recurrence, without blocking employees from using verified low-risk applications, and employees must have a way to ask for anything else. What should you do?

First respond to the incident: revoke the grants on the enterprise application, disable the application's sign-in, and revoke the affected users' tokens, because a password reset alone would leave the grant in place. Then set user consent to Allow user consent for apps from verified publishers, for selected permissions, and enable the admin consent workflow.

Choosing Do not allow user consent would meet the security goal, but it fails the requirement that verified low-risk applications remain usable. A Conditional Access policy that blocks the application targets sign-in, but it would not change how consent works in the tenant in future.

Check yourself

An application holds the delegated permission Mail.Read. Can it read every mailbox in the tenant?

Show answer

No. Delegated access is limited to what the signed-in user can reach. Reading every mailbox would need the application permission.

Exam Tips

Remember for the exam

  • Application permissions always need admin consent.
  • Delegated access is limited by the signed-in user's rights.
  • A password reset does not remove an OAuth grant.
  • Only a Global Administrator can approve Graph application permissions in the workflow.