cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
micpol
Frequent Visitor

Power BI REST API - retrieving activity events returns 403 / "API is not accessible for application"

Hello,

 

I am trying to get activity logs using a Power BI secrvice principal. Once a valid access token is retrieved, it is possible to use the Power BI REST API for example to get the groups (GET https://api.powerbi.com/v1.0/myorg/groups) - it works fine. 

 

Hoerver, when I attempt to get activity events (GET https://api.powerbi.com/v1.0/myorg/admin/activityevents) a 403 Forbidden error with the following message is returned:

{

"Message": "API is not accessible for application"
}


The service principal has all requires scopes and also the admin role. The doc says that it is possible to "authenticate via service principal"  (ref. to https://docs.microsoft.com/en-us/rest/api/power-bi/admin/getactivityevents), so my understaing is that this API can be used with a service principal.

 

Any idea?

 

Best regards,

Michal

4 REPLIES 4
SteveAtCity
New Member

I am seeing the same issue as @micpo and @sjkpdk when trying to use the activityevents API from Azure Data Factory. 

@V-lianl-msft :

Has anyone been able to get this method to work?

 

If not can what alternatives are there to extract power bi audit log activity?

 

What does the documentation mean by

  • " The user must have administrator rights . . . to call this API or authenticate via service principal."
  • "Required scope: Tenant.Read.All or Tenant.ReadWrite.All."
sjkpdk
New Member

We are also unable to get this to work. It is really fustrating when the docs state that it should work for a service principal, but in reality it doesnt seem to be the case. 

V-lianl-msft
Community Support
Community Support

Hi @micpol ,

 

You must meet these requirements to access the Power BI activity log:

  • You must either be a global admin or a Power BI service admin.
  • You have installed the  Power BI Management cmdlets locally or use the Power BI Management cmdlets in Azure Cloud Shell.

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @V-lianl-msft ,

 

thank you for your reply.

 

My case is related to embedding content for customers (https://docs.microsoft.com/en-us/power-bi/developer/embedded/embed-sample-for-customers?tabs=net-fra... , https://docs.microsoft.com/en-us/power-bi/developer/embedded/embed-service-principal ), so I am using a Power BI servcice principal (App account), not an AAD user account.

 

The service principal has been added to Power BI service admin list as well as required scopes have been set correctly.

 

Furthermore, I am talking to the Power BI service by means of the REST API (https://docs.microsoft.com/en-us/rest/api/power-bi/admin/getactivityevents) from within my application (backend), I am not using any Power BI Management cmdlets.

 

According to https://docs.microsoft.com/en-us/rest/api/power-bi/admin/getactivityevents it is possible to get authenticated via service principal. Note that other Power BI REST APIs are working fine.

 

In this particular case the message I am facing is "API is not accessible for application" and the HTTP error code is 403 Forbidden. It seems to me that the https://docs.microsoft.com/en-us/rest/api/power-bi/admin/getactivityevents does not work with a service principal.

 

Summarizing, is that feasible to get acticity events using a service principal created for the "embed content for your customers" case at all? I would like to have acccess to that activity log from within an application (backend).

 

Best reagrds,
Michal

 

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.