The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi Fabric Community,
I am building a Python web application that lets users upload their own cash flow data (CSV), which then triggers a refresh of a Power BI dataset via the Power BI REST API. My use case is for a “Power BI Embedded” scenario, but at this stage I am just testing with my own workspace and dataset.
My setup:
Azure AD App Registration (service principal) with the following permissions:
Power BI Service: Dataset.ReadWrite.All (Delegated, Admin Consent granted)
Also tried Tenant.ReadWrite.All but removed for security reasons.
Power BI workspace is a “classic” workspace, but I am workspace admin and have assigned the service principal as Contributor.
Redirect URI is set up and matches my Ngrok public URL, and authentication works (I get an access token and can list workspaces/datasets).
When I POST to /groups/{workspaceId}/datasets/{datasetId}/refreshes, I get a 403 Forbidden error.
Questions:
Does a Power BI Pro (free trial) license for the workspace admin (me) allow the use of Service Principal authentication to refresh datasets via REST API, or is Premium/PPU required?
Is Dataset.ReadWrite.All (Delegated) permission sufficient for the service principal to call the refresh API, or do I need to assign an Application permission? (This permission does not seem to be available for my app.)
Is there anything else I should check in Azure or the Power BI admin settings to allow this operation?
Could my license type (Power BI Pro Trial) or the fact that the workspace is not in a Premium capacity be the reason for the 403 error?
Debug details:
I receive a valid access token (“Access token acquired.”)
The API call to refresh the dataset returns 403, with no further error text.
Screenshots attached (showing permissions, error, workspace access, and API config).
Any help would be greatly appreciated! Thank you.
Tags: powerbi-rest-api, service-principal, permissions, dataset-refresh, pro-license, premium, embedded
Solved! Go to Solution.
Hi @MalaSun
Thanks a lot for the detailed explanation it's clear. To directly address your main issue.
Even though your service principal has the right permission (Dataset.ReadWrite.All) and you’ve added it as a Contributor to the workspace the reason you're hitting a 403 error is because. Dataset refresh via service principal is only supported in Premium or PPU (Premium Per User) workspaces. This means that with your current Pro trial license and non-Premium workspace, the Power BI REST API won't allow a service principal to trigger a dataset refresh. That’s a limitation by design from Microsoft, not something misconfigured on your end.
We have two clean options
Once that’s done, your existing service principal setup should start working perfectly.
Hope this clears up the mystery behind the 403.
If this response helps, consider marking it as “Accept as solution” and giving a “kudos” to assist other community members.
Regards,
Akhil.
Hi @MalaSun
Thanks a lot for the detailed explanation it's clear. To directly address your main issue.
Even though your service principal has the right permission (Dataset.ReadWrite.All) and you’ve added it as a Contributor to the workspace the reason you're hitting a 403 error is because. Dataset refresh via service principal is only supported in Premium or PPU (Premium Per User) workspaces. This means that with your current Pro trial license and non-Premium workspace, the Power BI REST API won't allow a service principal to trigger a dataset refresh. That’s a limitation by design from Microsoft, not something misconfigured on your end.
We have two clean options
Once that’s done, your existing service principal setup should start working perfectly.
Hope this clears up the mystery behind the 403.
If this response helps, consider marking it as “Accept as solution” and giving a “kudos” to assist other community members.
Regards,
Akhil.
Thank you for the insight. I’m currently building a proof of concept for internal use, with strictly controlled upload volume. Eventually I’ll implement rate limiting or background queues for refresh to prevent overload.
Right now, my issue is that even a single refresh call returns a 403 Forbidden despite valid permissions. Do you know if this API refresh is supported for service principals in Pro workspaces? Or is Premium/PPU strictly required?
I am building a Python web application that lets users upload their own cash flow data (CSV), which then triggers a refresh of a Power BI dataset via the Power BI REST API.
VBI (very bad idea). Your users with thrash the Power BI service with concurrent refresh requests. Best case you will get a 429 back, worst case you'll choke the capacity. Do not allow your report users to initiate semantic model refreshes.
Hi Ibendin,
Thank you for your comments. What alternative solutions could you recommend for what I wanted to achieve?
User | Count |
---|---|
17 | |
9 | |
5 | |
3 | |
3 |
User | Count |
---|---|
46 | |
23 | |
17 | |
13 | |
12 |