Microsoft Graph API returns "generalException" when accessing user drive via delegated access

Bonow 20 Reputation points
2025-04-25T07:19:24.7566667+00:00

Hi, I'm trying to download files from a specific user's OneDrive using the Microsoft Graph API via a Jenkins pipeline. I’m using the client credentials flow (delegated access), and I'm able to successfully retrieve the access token from Azure AD.

However, when I call the following endpoint:

GET https://graph.microsoft.com/v1.0/users/{userEmail}/drive

…I get the following error in response:

{ "error": { "code": "generalException", "message": "General exception while processing", "innerError": { "date": "2025-04-25T05:52:36", "request-id": "<something>", "client-request-id": "<something>" } } }

Things I've verified:

  1. I’m successfully obtaining an access token using:
  • grant_type=client_credentials
    • scope=https://graph.microsoft.com/.default
  1. My app has the following delegated permissions granted with admin consent:
  • Files.Read.All
    • Files.ReadWrite.All
  1. The userEmail used in the URL is a valid UPN and exists in our Azure AD tenant.

Note: I have implemented the above configuration using my personal account, and it works correctly.

However, it does not work for another domain account.

For example:

  • ******@abc.comworks
    • ******@xyz.comdoes not work
Microsoft Security | Microsoft Graph
{count} votes

Accepted answer
  1. Vasil Michev 119.5K Reputation points MVP Volunteer Moderator
    2025-04-25T15:31:16.0433333+00:00

    Delegated permissions can only be used to access drives to which the signed in user has been granted access, for your scenario it's best to use application permissions instead. Moreover, if you are leveraging the client credentials flow to obtain a token, you are already running with application permissions - make sure those are correctly added and consented to in the Entra portal. Use tools such as jwt.ms to decode your access token and confirm the permissions are correctly reflected therein.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.