Exchange Web Reporting - Basic Authentication to Modern Authentication for Message Trace Report

Pol Estecha 0 Reputation points
2023-02-02T15:38:29.0533333+00:00

Greetings!

We currently use the REST API Endpoint for Message Trace reports:

https://reports.office365.com/ecp/reportingwebservice/reporting.svc/MessageTrace/?$format=JSON

As you know this endpoint uses Basic Auth, which will be deprecated very soon in our environment. We have tried to move to Modern Authentication using a Service Principal (with ReportingWebService.Read.All & Security Reader Roles) & following the Client Authentication flow (Client Id, Client Secret), but with moderate success.

It seems that we are able to authenticate correctly (or at the very least we are not hit with the 401), although when trying with Modern Auth, we are hit with the following error:

<h2>404 - File or directory not found.</h2>
  <h3>The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.</h3>

We authenticate by sending a header containing the Auth header ("Authorization" : "Bearer TOKENHERE").

When trying to reach using Basic Auth, on the same URL & Report, we have no issues in retrieving the data.

We have seen this issue happen to other users aswell. Is there any step we are doing wrong?

Thanks!

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,582 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Vasil Michev 95,181 Reputation points MVP
    2023-02-02T16:10:30.7033333+00:00

    Seems to work fine for me, the scope (and user role) is what you should need. Can you paste the decoded token?