Search code examples
restpowerbiazure-data-factorymetadata

Power BI Metadata using Azure Data Factory (ADF)


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:

  1. Registered an app (permissions: Report.Read.All, Dataset.Read.All, Workspace.Read.All) - please mind that these permissions do not require admin consent
  2. Created a Security Group
  3. Added the app to the security group
  4. 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 workspace 6.I have created Linked Service in ADF: REST Base URL: https://api.powerbi.com/v1.0/myorg/ Authentication: Service Principal Test Connection - Successful 7. 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?


Solution

  • To use Admin API, please enable the below setting as well for service principal enter image description here

    enter image description here