Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
luskbo
New Member

Power BI Python API Access 2022

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 ).

 

Screen Shot 2022-08-11 at 3.35.22 PM.png

 

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).

 

Screen Shot 2022-08-11 at 3.38.50 PM.png

 

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?

 

4 REPLIES 4
luskbo
New Member

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.

lbendlin
Super User
Super User

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.

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.