Forum Discussion
Power BI API Connectivity in Azure Data Factory
Hello yubandi. Thanks for your reply. To answer your question about the startDateTime and endDateTime parameters, I'm not currently including them. The error that I'm getting is as follows:
"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,'"
I did include parameters in earlier calls but wasn't working. I can try and add it in again. Also yes, I did try doing this in Postman. I'm able to retrieve a token but when using it, I get the 403 forbidden error there.
Thank you for the update, this is very helpful. The permissions you mentioned (AuditLog.Read.All / ActivityLog.Read.All) won't appear since they're not needed for this Power BI API.
Based on your description, your setup seems correct. The problem is likely that the ActivityEvents API doesn't fully support service principals, which explains the 401/403 errors even though your configuration is correct.
Also, please ensure you're including startDateTime and endDateTime as they are required for this API. If you can, try the same request in Postman using a user login (Power BI Admin). If it works, it confirms this is a limitation with service principals.
Let me know what you find.