We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
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.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |