Forum Discussion
Power BI API Connectivity in Azure Data Factory
Hi sbrahmbhatt ,
We haven’t received a response from your end yet. Please let us know whether the issue has been resolved or if you’re still facing any difficulties. Feel free to reach out if you need further assistance.
- sbrahmbhatt4 months agoFrequent Visitor
Hello yubandi. Thanks for following up, yes we are still experiencing difficulties with accessing the API. I tried with/without date parameters as mentioned but still receiving the PowerBINotAuthorized exception. When parameters were included the default values are included as follows with startDateTime = '2025-01-20T00:00:00Z' and endDateTime = @utcnow()
The Dataset properties in Source are set with the same values as shown below:
The full error message is below with or without input parameters specified.
"ErrorCode=RestCallFailedWithClientError,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Rest call failed with client error, status code 401 Unauthorized, please check your activity settings.
Request URL: https://api.powerbi.com/v1.0/myorg/admin/activityevents.
Response: {"error":{"code":"PowerBINotAuthorizedException","pbi.error":{"code":"PowerBINotAuthorizedException","parameters":{},"details":[],"exceptionCulprit":1}}},Source=Microsoft.DataTransfer.ClientLibrary,'"So it still seems to be a permissions issue but seems I have all required permissions granted. The only item that I've seen online that looks to be required is Activity.Read.All. I don't see that this is something I have, not sure how to tell if this permission is available. How would you suggest I check for this? Please let me know of any other suggestions as well. Thanks again for your assistance!
- arabalca4 months agoSuper User
Hello sbrahmbhatt,
The PowerBINotAuthorizedException (401) error in this case is usually related to one of these two points. Let me explain how to validate them clearly:
The first one is that the Activity.Read.All permission may not be correctly assigned. This permission does not belong to Microsoft Graph, but to the Power BI API specifically. To configure it, go to Azure Portal → App Registrations → select your application → API Permissions → Add a permission → APIs my organization uses → search for “Power BI Service” → add the delegated permission Activity.Read.All. Very important: after adding it, you must click Grant admin consent, otherwise the permission will not be included in the token even if it appears configured. You can find the official documentation here: https://learn.microsoft.com/en-us/rest/api/power-bi/
The second point is to verify that the token being used (from ADF or Postman) is correct. A very common mistake is generating the token against the Microsoft Graph scope instead of the Power BI scope. The correct scope for this API is https://analysis.windows.net/powerbi/api/.default. You should ensure that the token is issued for the Power BI resource (https://analysis.windows.net/powerbi/api) and that it includes the Activity.Read.All permission. If the token is issued for a different resource such as Microsoft Graph, it will result in a 401 error even if everything else is properly configured.
If my comment helped solve your question, it would be great if you could give it a like and mark it as the accepted solution. This helps others with the same issue and also motivates me to keep contributing. Thanks a lot, I really appreciate it.
- V-yubandi-msft4 months agoCommunity Support
HI sbrahmbhatt ,
Thank you for the detailed explanation. To clarify, since this setup uses Service Principal, permissions like Activity.Read.All / AuditLog.Read.All won’t be listed there. These are delegated permissions, so it’s normal not to see them.
Based on your information, your configuration seems correct. The issue may be due to the limitation with ActivityEvents API and Service Principal, which can result in 401/403 errors even when everything is set up properly.
If you haven’t already, it might help to test with a Power BI Admin user login in Postman to confirm.
Thank You.