Forum Discussion
Usage Metric Report(Organization lvl)
Hi, so I want to create a consolidated usage metric report for 17 workspaces.
I don't have the Admin Portal access . I don't know how to fetch all the data
What should I use? How should I use it? Some say power bi rest api, some say Power Automate.
Also, the client wants it for 120 days. Please guide if you know how, it's urgent. Help would mean a lot to me.
Hi PowerBiLearner4 ,
Thanks for the update.
With the permissions that you currently have, it’s not possible to get organization-level usage metrics for 17 workspaces over 120 days. Without tenant admin approval for the Power BI Admin APIs, you can only access workspace-level usage reports, and those don’t provide 120 day history. To get the full 120 day, tenant-wide usage data, admin access or a service principal enabled for admin APIs is required. Once the permission is granted, the extraction can be fully automated.Thank you.
18 Replies
- tayloramy
Super User
Hi PowerBiLearner4,
Without admin access, this is going to be challenging.
The way I am doing this at my org us by using the admin REST APIs, specifically getActivityEvents which gives me all activity that happens in Fabric.
To use these APIs however, you need Farbic Admin access, or a service principal with access and the tenant setting "service principals can use admin APIs" enabled.
If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.
- PowerBiLearner4Frequent Visitor
Do you have the steps you followed with you?
- tayloramy
Super User
Hi PowerBiLearner4,
I am using a custom python script to pull the audit data.
This is the function that pulls data:
def query_powerbi_audit(start_datetime, end_datetime, filter_query=None): headers = { 'Authorization': f'Bearer {get_access_token()}', 'Content-Type': 'application/json' } params = { 'startDateTime': f'\'{start_datetime}\'', 'endDateTime': f'\'{end_datetime}\'', } if filter_query: params['$filter'] = filter_query all_events = { "activityEventEntities": [], } # Start with the initial API URL for the first request. This will be updated in the loop below. current_url = API_URL while True: # Send the request response = requests.get(current_url, headers=headers, params=params) response.raise_for_status() # Raises an error for bad responses (4xx or 5xx) # Parse the response data = response.json() all_events["activityEventEntities"].extend(data.get("activityEventEntities", [])) # Check if there's more data to fetch if data.get("lastResultSet"): break # If lastResultSet is true, we are done # Update the URL for the next request using continuationUri current_url = data.get("continuationUri") if not current_url: break # If there's no continuationUri, we are done # Clear params for the next request params = {} # Reset params for the next request return all_eventsIf you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.
- v-echaithra
Community Support
Hi PowerBiLearner4 ,
May I ask if you have resolved this issue? Please let us know if you have any further issues, we are happy to help.
Thank you.
- v-echaithra
Community Support
Hi PowerBiLearner4 ,
We’d like to follow up regarding the recent concern. Kindly confirm whether the issue has been resolved, or if further assistance is still required. Please let us know if you have any further issues, we are happy to help.
Thank you.
- PowerBiLearner4Frequent Visitor
Hi I am still facing issue v-echaithra
i have registered an app with this permission what the next step can you help please ?
- PowerBiLearner4Frequent Visitor
No issue is not yet resolved v-echaithra
- lbendlin
Super User
Usage Reports are strictly limited to the workspace. Use the Tenant Audit logs instead.
- v-echaithra
Community Support
Hi PowerBiLearner4 ,
We’d like to follow up regarding the recent concern, wanted to check weather you have tried with Tenant Audit logs. Kindly confirm whether the issue has been resolved, or if further assistance is still required. We are available to support you and are committed to helping you reach a resolution.
Best Regards,
Chaithra E. - PowerBiLearner4Frequent Visitor
I have registered an app with AuditRead.all permissions are you talking about that ?
- PowerBiLearner4Frequent Visitor
I dont know if you guys got the reply not able to see so posting here again
Sorry i was facing some issue so i was not able to login
v-echaithra tayloramy lbendlinI registered an app on azure with the following permission. What the next step?
tayloramy will this permission work for your script ?
lbendlin are you talking about AduitRead.all- tayloramy
Super User
Hi PowerBiLearner4,
To use the admin REST APIs, the "service proncipals can access read only admin APIs" switch in the admin portal needs to be turned on.
Enable service principal authentication for admin APIs - Microsoft Fabric | Microsoft Learn
If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.
- PowerBiLearner4Frequent Visitor
Yep Raised a new request to grant my service principal the access lets see
- v-echaithra
Community Support
Hi PowerBiLearner4 ,
Thanks for the update.
With the permissions that you currently have, it’s not possible to get organization-level usage metrics for 17 workspaces over 120 days. Without tenant admin approval for the Power BI Admin APIs, you can only access workspace-level usage reports, and those don’t provide 120 day history. To get the full 120 day, tenant-wide usage data, admin access or a service principal enabled for admin APIs is required. Once the permission is granted, the extraction can be fully automated.Thank you.
- v-echaithra
Community Support
Hi PowerBiLearner4 ,
May I ask if you have resolved this issue? Please let us know if you have any further issues, we are happy to help.
Thank you.