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.
Microsoft Graph API returns "generalException" when accessing user drive via delegated access
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:
- I’m successfully obtaining an access token using:
-
grant_type=client_credentials
-
scope=https://graph.microsoft.com/.default
-
- My app has the following delegated permissions granted with admin consent:
-
Files.Read.All
-
Files.ReadWrite.All
-
- 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.com
— works-
******@xyz.com
— does not work
-
Microsoft Security | Microsoft Graph
-
Vasil Michev 119.5K Reputation points MVP Volunteer Moderator
2025-04-25T15:31:16.0433333+00:00