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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. 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
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Kudoed Authors