I have an Azure Function that accesses Dynamics 365 reports. It first retrieves an access_token. Then posts to /CMSReports/RSViewer/ReportViewer.aspx to retrieve a report session. Then posts another request to /Reserved.ReportViewerWebControl.axd which then response with an output stream of the report.
Everything works fine with an existing service account we have in place. But we want to move away from using that service account and replace it was an app registration account.
I'm able to access Dynamics 365 data with my app account (no issues with the token). But when I try to use that same token to make a request from ReportViewer, it returns HTML content which looks to be a login page.
App account has the same AD roles as the service account. I've added every permission possible to the associated user in Dynamics. I've also added a ton of different API Permissions on the app registration record, but I'm obviously missing something else.
Does something additional need to be granted to this app registration in order to access the ReportViewer?