Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Having trouble authenticating to Power BI via API. Uusually pretty good at finding some help online, but there are many different explanations on how to do this, and alot of them are historic.
My setup and testing so far:
I have an app registration, setup with delegated permissions. ( Likely too may permissions ).
I'm able to get an access token by authenticating with client id and secret, by using the .default scope.
( Maybe the wrong scope and grant type here, but only way I can get a token).
From here, I attempted to use this token to make a POST request to the Power BI EndPoint.
https://api.powerbi.com/v1.0/myorg/groups/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/datasets
However, I only ever get a 403.
I found another post on this forum where another user had this same issue, but seems either outdated or not applicible to what I am trying to do.
https://community.powerbi.com/t5/Developer/Access-Power-BI-API-with-Python/m-p/189165#M6015
Any ideas on what I'm doing wrong here?
Thanks. Yea, I guess I just don't understand how the scopes work. Have granted the app registration the API permissions and aquired the token with the app registrations ClientID and Secret. I would think that it would get the correct scopes.
Only thing that I can think of is that the user delegation is missing. Will keep hunting I guess.
Check your token at jwt.io - most likely it has the wrong or insufficient scope.
Thanks for the reply. I did check, and noticed that the decoded token doens't contains any scopes.
When I request the token, I have been using .default. Do you know if this may be the problem?
Yes, that is the issue. If you get a token via a different process (powershell for example) and examine it you will see it has all the scopes, and it works. No scope = no work. The .default thing fails somewhere but I don't understand where. Nobody was able to explain that to me yet.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 9 | |
| 6 | |
| 4 | |
| 4 | |
| 4 |