I am trying to download metadata from Power BI and then store it in Snowflake.However, I'm having troubles with accessing API with my app.
What I have done so far:
- Registered an app (permissions: Report.Read.All, Dataset.Read.All, Workspace.Read.All) - please mind that these permissions do not require admin consent
- Created a Security Group
- Added the app to the security group
- Enabled 'Service principals can use Fabric APIs' in Power BI and added the Security Group to 'Apply to'Power BI settings
5. Added the security group as a member to the particular workspace6.I have created Linked Service in ADF:RESTBase URL: https://api.powerbi.com/v1.0/myorg/Authentication: Service PrincipalTest Connection - Successful7. Created REST dataset (Linked Service as above)Relative URL: "admin/activityevents?startDateTime=2024-12-15T07:55:00.000Z&endDateTime=2024-12-30T07:55:00.000Z"8. Created COPY DATA activity with above dataset + linked service
I get the following error:"...Rest call failed with client error, status code 403 Forbidden, please check your activity settings.Response: {"Message":"API is not accessible for application"}..."
And at this point I do not know what to do...What I tried:
- adding AuditLog.Read.All permission --> however, I found info that it should not be granted as it requires admin consent (and admin consent is already granted through Power BI and it may generate a conflict)
- created a pipeline so that it first generates Token, and then I use another WEB activity to call API (HTTP address like above) but adding at the end the generated token: "...&continuationToken="Here I get the following error:"Invoking endpoint failed with HttpStatusCode - '403 : Forbidden', message - 'Endpoint(url) refused the request as the given identity is not authorized to perform this action. Please get the necessary permissions & retry."
I am not so sure what should be done next.
The "Power BI Service Administrator" role has not been granted to the service principal as I read that it is not necessary as long as 'Service principals can use Fabric APIs' has been enabled in Power BI.
Could anybody help?