Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello,
I am trying to use admin activity events api to get views on reports in a workspace. I have created these following activities to provide proper api access:
-Registered the api
-Gave powerbi application permission api access for tenant.read.all
-Granted Admin consent
-created a secret
-Modified powerbi tenant setting to allow service principal to call the API
-Created a security group and added my enterprise application in that security group and added that in powerbi tenant settings to call the API
-Even added the enterprise application in Fabric adminstrator role and it still returns 401 unauthorized.
The report level api returns data, but admin activity event doesn't return anything other then 401.
Can someone please provide any guidance on what else could I be missing and I am testing the API call in postman to see if it gives me the 200
Hi @avipat1 ,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
Hey @VE I made a python script to loop over the api call to get all events for the past 30 days as you can make 200 api calls in an hour so I am following that process and ingesting my data into azure sql db! Thank you for your help!
Hi @avipat1 ,
No, the GetActivityEvents API only supports retrieving one day of data per request.You cannot get multiple days in a single call.
As a Workaround to get more than one day of metrics, you need to call the API repeatedly, once per day, using different startDateTime and endDateTime values for each date.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly.
Thank you.
Hi @avipat1 ,
I wanted to check if you had the opportunity to review the information provided.If the response has addressed your query, please accept it as a solution, so other members can easily find it.
Thank you.
Hi @v-venuppu ,
Thank you for your response and giving me some tips! I tried the steps you mentioned but they didn't give me the 200OK for getactivityevents API. I tried going the delegated permissions route and gave it tenant.read.all and write.all and kept everything else same as I mentioned up there and it worked and now I am getting all of the events for a day! Thank you for providing a repsonse and give me some tips to try out. Would you know if there is a way to get more then one days worth of views metrics from that call or we can only get one day and there is some other work around we have to do?
Hi @avipat1 ,
Thank you for reaching out to Microsoft Fabric Community.
It looks like you've set up most things correctly, but the 401 Unauthorized error usually comes down to one or two key missing steps.
Here’s a simple checklist to help you fix it:
1.Make sure your app has the AuditLog.Read.All permission (not just Tenant.Read.All).
2.When generating the token, you must request it for Microsoft Graph, not just Power BI(Use Graph API token scope)
3.Even if the service principal is added in Fabric Admin, the activity events API only works if it's a Power BI Admin (or Global Admin).
4.Audit data can take up to 24 hours to show up. So if you’re testing with very recent activity, it might return empty even if authorized correctly.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly.
Thank you.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
9 | |
8 | |
4 | |
2 | |
2 |
User | Count |
---|---|
4 | |
3 | |
3 | |
3 | |
2 |