Building a Power BI Admin View [Part 2]: Obtaining a Refreshable Access Token

preview_player
Показать описание
This is part 2 of our 4-part series on how to create a Power BI Admin View report. In this topic, we learn how to retrieve an access token to refresh our Power BI report when calling the Power BI API. We also walk through some steps to clean up the data import steps by using the "expand" keyword when connecting to the workspaces.

Marc's Website and Blog:

----------------------------------------------------------------------------------------------

To enroll in my introductory or advanced Power BI courses:

Elite Power BI Consulting:

Data Insights Tools:

Connect with me on Twitter!
Рекомендации по теме
Комментарии
Автор

OMG thank you! I have been looking for this EVERYWHERE!

tinabachova
Автор

I managed to get it working through application only:
Requirements:
1) Power BI Service Admin
2) Someone enabled to create apps and security groups in Azure Portal

How to:
1) Create an App in Azure, get its ID.
2) Create an App secret for you APP, get its value ID (not the secret ID).
3) Give you app all the readonly permissions to the power bi service (may work without the permissions).
3) Create a Security Group in Azure then add the app as a member.
4) Enable in power bi admin portal the following options for your security group:
"Allow service principals to use Power BI APIs"
"Allow service principals to use admin readonly APIs"
OBS: I don't use the power bi service in english so the text might be a little different.

5) Add your security group as admin (might work with other roles) in every workspace. (The app won't be able to see a workspace it doesnt' have access)
6) Intead of using the 'password' grant_type use 'client_credentials', no need to send the 'username' and 'password' in the request but it's necessary to send 'client_id' (with value app ID from step 1) and 'client_secret' (with value app secret ID from step 2).
Function 'GET Access Token' will look like this:
() =>
let
body = "client_id=step1_ID"
& "&client_secret=step2_ID"
&
access_token = Data[access_token]
in
access_token

OBS: The access you give to in the workspaces to the security group may take a few minutes to get caught by the API

That's it! :)

mscapeletti
Автор

Thankyou parker, I am not the powerBI pro but this is exactly I needed for the task in hand.

amitkshik
Автор

Eager for the next video in the series.. :)
Thanks Parker for another fantastic video..

tejasbrahmbatt
Автор

This is such an amazing video. Thousands of thanks!! :)

AHMEDALDAFAAE
Автор

Really thank u sooo much, I was searching this in almost website, now my work successfuly done

premkumarramalingam
Автор

This is amazing stuff. Is there a way to bypass MFA?

murtazaulhasan
Автор

Expand is only if you are admin. Looping is still good if you're not. Thanks a alot!

Papaecho
Автор

Is it possible to download the PBIX you put together for this series?

Randyminder
Автор

Hello I know if is an older video but it is brand new to me. I am look to see if it possible to use the Api secret vs a user ID and password?

gregstirewalt
Автор

I am using the client credential grant type. For the government website. What was the resource URL for me? is the same as the token url? and I have the client id, subscription key, and secret.

sowjanyag
Автор

Enjoying the series so far. The issue with using the $expand method is that it doesn't give you all of the information around a content type. For instance $expand for Reports doesn't give you these columns: embedurl, weburl, modifiedby, createdby. Anyway around that rather than having to use the method detailed in part 1?

charlesd
Автор

my code is working in postman but it gives response 400 in power query. Please advise

rakeshnag
Автор

Hey Parker - as always, great Playlist covering a popular topic! Do you have any advice/considerations how this can be handled when the user context has MFA enforced at a tenant level?

theashtonsdaddy
Автор

Can't wait to see part 3.... Still coming I hope?

jefflingen
Автор

love the video, but having to type the code from the video leads to errors. Can you put a link to the resource? I couldn't find part 2 on your blog.
In Workspaces, I have used anonymous but not getting "edit credentials" and have cleared credentials, edited, etc. It won't work now with anonymous (or anything else). Do you know what I am doing incorrectly?

electrobrit
Автор

Can I add the Data-sources to the expand parameter or do I have to loop like the previous video?
loop every datasets with GetDatasourcesAsAdmin would work but will be many request´s.

bertljung
Автор

Hi Parker, great content. I've recently been exposed to API calls and I've experienced what you are doing in both Power Query and Power Automate. However, I also came across API's, mainly used in Government departments, which use an API protocol called SOAP which I just haven't been able to crack. I can't even get Postman to connect. Any suggestions?

stevedoherty
Автор

Does this solution work if I publish this report to Power BI Service and schedule automatic refresh?

elzbietadoniek
Автор

Hi - I had this all working previously but it seem sthat now the api url requires MFA anyone know who to make this work with MFA?

HabariYaMere