Forum Discussion

JamieHut's avatar
JamieHut
New Member
2 months ago
Solved

Get Activity Events API - PowerBINotAuthorizedException Error

Hi all,

I'm trying to get the report usage data out of the org's Power BI environment, but I keep running into this error: "PowerBINotAuthorizedException"

In order to facilitate this I have registered an app in Entra ID, which has been granted "Tenant.Read.All" privileges for Power BI. I have added the app to a security group, and the security group has been enabled to acces Read-Only APIs in Power BI. The user account running the flow has also been added to the security group for good measure.

I have tried in Power Automate and Postman, first generating a token, then trying to query the PBI API with said token, I get the same error in both cases. 
Here's the token generation, I am using our Tenant ID in the URI, client ID & secret from the app:

I then put that token into the HTTP call, which I have tried with and without parameters (i.e. filtering on username, specific days, either of the above or none of the above).

I have also done this without the Get Token step, simply using the authentication in the advanced parameters of the HTTP step, which leads to the same error.
I've also additionally tried adding in both the user account that runs the flow and the service principal (app) itself as admins to all the workspaces on Power BI, which made no difference.

Has anyone here encountered (& resolved) this issue?


The API documentation:
https://learn.microsoft.com/en-us/rest/api/power-bi/admin/get-activity-events

 

2 Replies