Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
464 views
in Technique[技术] by (71.8m points)

How to use Power BI REST API's in Azure Data Factory

I am trying to create a list of all the workspaces and the reports contained in each one of them for a documentation project.

I found online that we can use this to get the workspaces, I wanna use it with a "web" activity:

https://api.powerbi.com/v1.0/myorg/groups

And then I want to use the IDs we get in the output with a foreach and another web activity inside of it and use this to get the reports in each workspace, then copy it somewhere (datalake or DB) :

https://api.powerbi.com/v1.0/myorg/groups/{groupId}/reports

But I don't know how to configure the activity and the authentication.

If there is a better way like connecting directly to Power BI I'm all ears, I tried to do a get data from web source but I don't have any "key" for API and organization authentication doesn't work.

When I run the code here: https://docs.microsoft.com/en-us/rest/api/power-bi/groups/getgroups it works perfectly.

Thanks in advance

question from:https://stackoverflow.com/questions/66063971/how-to-use-power-bi-rest-apis-in-azure-data-factory

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

'But I don't know how to configure the activity and the authentication.' For this question, I'm not sure if you don't know how to use access token to call an API.

  1. Register an azure ad application with the api permission of 'https://analysis.windows.net/powerbi/api/Workspace.ReadWrite.All' so that you can generate an access token by this application with this scope. Add api permission.
  2. Use ropc flow to generate an access token. This flow contains user information so that your api could know who you are to return correct groups.
  3. Add 'Authorization' in request head with value of 'Bearer accessToken' to call the api.

enter image description here enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...