Forum Discussion
Power BI API GetActivity Metrics Issue with Power BI Service Principal
- 10 months ago
I wanted to make sure that I rounded this out. Looking further into the documentation around the Admin APIs. There are a couple things that needed to happen to grant my SP access.
1. The documentation states that "When running under service prinicipal authentication, an app must not have any admin-consent required premissions for Power BI set on it in the Azure portal." (Admin - Get Activity Events - REST API (Power BI Power BI REST APIs) | Microsoft Learn) This meant I needed to revoke any admin-consent required permissions Tenant.Read.All and Tenant.ReadWrite.All
2. I needed to have the SP granted the role of Fabric Admin. (Not sure if this was necessary)
3. I had already done this but for a rounded out solution you need to make sure that Power BI Admin portal had "Service Principals can use Fabric APIs" and "Service Principals can use read only Admin APIs" flipped to "enabled" with the security group your SP is in the only group granted access.
The points in number 1 & 2 were new to me, a couple years ago I was able to set it up with the admin consent permissions, this however must have changed. Once I followed the three above, the SP could access no problem.
You can check the relationship between tables in Model view.
Sometimes inactive relationships or wrong cross filter direction
cause this issue. Also verify if the visual interaction is enabled.