--- title: "Troubleshoot AADSTS65001 Consent Required Errors for Enterprise Applications" slug: "dex-wf-troubleshoot-aadsts65001-consent-required" updated: 2026-11-30T16:15:38Z published: 2026-11-30T16:15:38Z canonical: "documentation.sysaid.com/dex-wf-troubleshoot-aadsts65001-consent-required" --- > ## Documentation Index > Fetch the complete documentation index at: https://documentation.sysaid.com/llms.txt > Use this file to discover all available pages before exploring further. # Troubleshoot AADSTS65001 Consent Required Errors for Enterprise Applications Diagnose and resolve `invalid_grant` consent errors by auditing OAuth2 permission grants and granting tenant-wide admin consent for missing resources. **Complexity:** Intermediate. **Impact:** access + troubleshooting + applications + consent + entra-id. ## Why use this workflow The `AADSTS65001` error (*The user or administrator has not consented to use the application*) is a common sign-in error that admins encounter with enterprise applications in Microsoft Entra ID. It typically appears when an application requests permissions (scopes) for a resource, such as Microsoft Graph, SharePoint Online, or Exchange Online, that neither the user nor an administrator has consented to yet. A frequent scenario: an admin grants tenant-wide consent for an app's Microsoft Graph permissions, but the same app also needs permissions for a *different* resource (such as SharePoint Online), and that second resource was never consented to. Users then hit `invalid_grant` errors as soon as the app tries to obtain a token for the resource without consent. Run this workflow when: - A user reports `AADSTS65001` or `invalid_grant` errors in a browser, Teams app, or partner SaaS tool. - An app previously worked but started failing for a specific feature (for example, SharePoint file access or mailbox reads). - You granted admin consent but some scopes still prompt users individually. - Tenant-wide user consent is restricted and the app requires admin approval. ## Expected outcomes - You identified the application (`appId`), service principal, and affected user that cause the consent failure. - You enumerated all existing OAuth2 delegated permission grants for the app (per-user and tenant-wide). - You identified which **resource** (Microsoft Graph, SharePoint Online, Exchange, and so on) is missing consent. - You reviewed the tenant's `authorizationPolicy` to determine whether users are permitted to grant consent themselves. - You granted admin consent for the missing resource, or documented why consent cannot be granted. - You verified that the user can sign in and use the affected application features. ## Risks and considerations ### Risks and gotchas - **Do not grant admin consent blindly.** Review every requested scope. Permissions such as `Directory.ReadWrite.All`, `Mail.ReadWrite`, or `Sites.FullControl.All` give the app broad tenant-wide capabilities that you cannot scope to specific users afterward. - **Verify publisher trust.** Confirm the app's publisher domain and Microsoft verified publisher status before you consent. Malicious apps frequently impersonate legitimate brands. - **Consent-phishing risk.** If the user reached the consent prompt through an email link rather than by launching the app from your SSO portal, treat it as a potential phishing attempt until proven otherwise. - **Tenant-wide consent is hard to undo at scale.** Removing a granted permission requires revoking the `oauth2PermissionGrant` object and, for app-only permissions, the `appRoleAssignment`. Users with cached tokens may continue to use the app for some time after the revocation. - **Compliance.** Some regulated environments (for example, HIPAA, FedRAMP, or SOX) require a change-management ticket and approval before you grant new application permissions. Check your organization's policy before you select **Grant admin consent**. - **Do not reset the user's password or MFA.** This is an application consent issue, not a user authentication issue. ## Required permissions | Permission | Why it's needed | | --- | --- | | User.Read.All | Resolve the affected user's object ID and validate the account state. | | Application.Read.All | Read service principal metadata for the application with the consent issue. | | DelegatedPermissionGrant.ReadWrite.All | Read existing oauth2PermissionGrants and create new grants to resolve missing consent. | | AppRoleAssignment.ReadWrite.All | Manage application-role (app-only) assignments when admin consent is required. | | Policy.Read.All | Read the tenant authorizationPolicy to determine whether user consent is permitted. | | AuditLog.Read.All | Read sign-in logs and directory audit logs to correlate the consent failure to a specific user and app. | | Directory.Read.All | Look up resource service principals (Microsoft Graph, SharePoint Online, Exchange) by appId. | ## Ask Dex Paste the prompt into a Dex conversation. ### Prompt for IT admins ``` {user} is getting AADSTS65001 'consent required' / invalid_grant error when using application {app_id} (correlation ID {correlation_id}). Investigate which resource is missing consent by checking sign-in logs and existing oauth2PermissionGrants, then recommend or apply tenant-wide admin consent for the minimum required scopes. ``` ### How an end user can ask Dex ``` I'm getting an error that says 'consent is required' when I try to use one of our company apps. Can you help me get access? ``` ## Manual steps (admin center) ### Step 1: Identify the application and the affected user Collect the following from the user's error message (or from the browser developer tools): - The `client_id` (application ID) in the consent URL. - The `Correlation ID` from the error page. - The user's UPN (email address). ### Step 2: Review the sign-in log 1. Sign in to the [Microsoft Entra admin center](https://entra.microsoft.com). 2. Go to **Identity** > **Monitoring & health** > **Sign-in logs**. 3. Filter by **User** for the affected user, or paste the Correlation ID into the search box. 4. Open the failing sign-in entry and examine the **Basic info** and **Additional details** tabs. Record the *Resource* name (this is the resource that is missing consent) and the *Application*. ### Step 3: Inspect the enterprise application's existing permissions 1. Go to **Identity** > **Applications** > **Enterprise applications**. 2. Search for and select the application. 3. Under **Security**, select **Permissions**. 4. Review the **Admin consent** and **User consent** tabs. Confirm whether the resource that you identified in Step 2 has any granted scopes listed. ### Step 4: Check the tenant user consent policy 1. Go to **Identity** > **Applications** > **Enterprise applications** > **Consent and permissions** > **User consent settings**. 2. If user consent is set to **Do not allow**, users cannot consent for themselves. An admin must grant consent for every new resource that the app requests. ### Step 5: Grant admin consent for the missing resource 1. Return to **Enterprise applications** > your app > **Security** > **Permissions**. 2. Select **Grant admin consent for** your tenant. 3. Sign in as a Global Administrator or Privileged Role Administrator. 4. Review the full consent prompt carefully. It now includes the resource that was missing (for example, Office 365 SharePoint Online). Accept *only* if every scope is justified. 5. Return to the **Permissions** page and confirm that the new resource is listed under **Admin consent**. ### Step 6: Validate with the user Ask the user to close their browser, clear cached tokens if necessary, and retry the action. If they continue to see `AADSTS65001`, wait for directory replication and retry. ## Microsoft Graph API ### 1. Resolve the affected user ``` GET https://graph.microsoft.com/v1.0/users?$filter=userPrincipalName eq '{user_upn}'&$select=id,displayName,userPrincipalName,accountEnabled ``` ### 2. Resolve the application's service principal ``` GET https://graph.microsoft.com/v1.0/servicePrincipals?$filter=appId eq '{app_id}'&$select=id,displayName,appId,appRoleAssignmentRequired ``` Record the returned `id` as the **clientId** (the service principal object ID) for the following calls. ### 3. Correlate the sign-in failure ``` GET https://graph.microsoft.com/v1.0/auditLogs/signIns?$filter=userId eq '{user_id}'&$top=10&$orderby=createdDateTime desc ``` Find the entry that matches the user's `correlationId`. Note the `resourceId` and `resourceDisplayName`. This is the resource that needs consent. ### 4. Enumerate existing delegated grants for the user ``` GET https://graph.microsoft.com/v1.0/oauth2PermissionGrants?$filter=clientId eq '{sp_object_id}' and principalId eq '{user_id}' ``` ### 5. Enumerate tenant-wide (AllPrincipals) grants ``` GET https://graph.microsoft.com/v1.0/oauth2PermissionGrants?$filter=clientId eq '{sp_object_id}' and consentType eq 'AllPrincipals' ``` Compare the returned `resourceId` values to the `resourceId` from Step 3. A missing resource confirms the root cause. ### 6. Check the tenant authorization policy ``` GET https://graph.microsoft.com/v1.0/policies/authorizationPolicy ``` Inspect `defaultUserRolePermissions.permissionGrantPoliciesAssigned` to determine whether users are allowed to consent for themselves. ### 7. Resolve the resource service principal (by displayName or appId) ``` GET https://graph.microsoft.com/v1.0/servicePrincipals?$filter=displayName eq 'Office 365 SharePoint Online'&$select=id,displayName,appId ``` ### 8. Grant tenant-wide delegated consent for the missing resource ``` POST https://graph.microsoft.com/v1.0/oauth2PermissionGrants Content-Type: application/json {  "clientId": "{sp_object_id}",  "consentType": "AllPrincipals",  "resourceId": "{resource_sp_object_id}",  "scope": "Sites.Read.All AllSites.Read User.Read" } ``` **Note:** `scope` is a space-separated list of delegated permissions. Always review and minimize the scopes that you grant. ### 9. Verify Re-run the query in Step 5 and confirm that the new `resourceId` is present. Ask the user to retry the failing operation. ## PowerShell These steps walk through the full diagnostic path: resolve the user, resolve the app, find the failing resource from the sign-in logs, inspect existing grants, and (optionally) create the missing tenant-wide grant. ### Prerequisites - PowerShell 7 or later with the `Microsoft.Graph` module installed (`Install-Module Microsoft.Graph`). - An account with at least the **Privileged Role Administrator** or **Application Administrator** role to grant consent. ### Key cmdlets used - `Connect-MgGraph`: authenticate with the required scopes. - `Get-MgUser`: resolve the user. - `Get-MgServicePrincipal`: resolve the app and the resource. - `Get-MgAuditLogSignIn`: correlate the sign-in failure. - `Get-MgOauth2PermissionGrant`: enumerate existing grants. - `New-MgOauth2PermissionGrant`: create the missing grant. ### Approach 1. Run the diagnostic part first, in read-only mode: resolve the user and the app, pull the failing sign-in by correlation ID, and list the existing grants. 2. Review the output to see which resource is missing consent and which scopes the app requires. 3. Only after review, create the tenant-wide grant with `New-MgOauth2PermissionGrant`, limited to the scopes you approved.