Unable to Retrieve Microsoft 365 Copilot Usage Data Using Graph API with Service Principal Account

Bumb, Pooja 25 Reputation points
2025-02-28T16:15:53.66+00:00

Hello,

I am trying to retrieve Microsoft 365 Copilot usage data using the Microsoft Graph API with a service principal account. Below are the API permissions set.

User's image

However, I am encountering issues with permissions and receiving the following error message. Could someone please help me verify the correct API permissions required to access Microsoft 365 Copilot usage data using a service principal account? Any guidance on resolving this issue would be greatly appreciated. If it's necessary to know, I'm using Certificate to authenticate.

{
  "error": {
    "code": "UnknownError",
    "message": "{\"error\":{\"code\":\"S2SUnauthorized\",\"message\":\"Invalid permission.\"}}",
    "innerError": {
      "date": "2025-02-24T18:11:04",
      "request-id": "d8ee10da-ffd4-4f8a-a87b-b6672f72b285",
      "client-request-id": "d8ee10da-ffd4-4f8a-a87b-b6672f72b285"
    }
  }
}
Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

Accepted answer
  1. Vasil Michev 119.6K Reputation points MVP Volunteer Moderator
    2025-02-28T16:48:39.94+00:00

    You have added Delegate permissions, which means the application must run in the context of a user, and the resulting set of permissions are the cross-section between the permissions granted on the app/SP, and the ones granted on the user. If you intend to run this in the delegate context (as a user), make sure the user has been assigned the Report Reader role in Entra/M365. If you need an automated solution instead (running without a signed in user), you need to grant Application permissions to your app, not delegate ones.


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.