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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
TePe
Helper III
Helper III

M function to read from api.powerbi.com

I'd like to create a M function which reads from api.powerbi.com. Any idea how to authenticate with this data source? I had no luck with basic (didn't work) and Organizational (not supported). 

4 REPLIES 4
v-yiruan-msft
Community Support
Community Support

Hi @TePe ,

Which information you need to read from api.powerbi.com? Could you please provide more detail? Thank you.

Best Regards

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

 

I need the list of workspaces with their users... So I wanted to use this API: 

 

https://api.powerbi.com/v1.0/myorg/admin/groups?$expand=users&$top=100

 

I tried it via M code and the Web data source, but how to authenticate?

 

Thanks,

 

 

Thomas

Hi @TePe ,

How did you connect to that API? And whether you get any error when connected? If yes, could you please provide the related screen shot?

In addition, please check if the following blogs can help you.

how to connect my web api wtih Power BI Reports?

Why is it so complex to connect to an API with Power BI or Power Query? The OAuth explained

API Strategies with Power BI

ACCESS TO THE RESOURCE IS FORBIDDEN ON POWER BI DESKTOP

Best Regards

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

 

I'm trying two different way...

 

One is simply using the web source and using something like https://api.powerbi.com/v1.0/myorg/groups as a source. 

The alternative is that I use a M script like this:

 

(MyDomain as text) =>

let

Source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/" & MyDomain & "/admin/groups?$expand=users&$top=100")),
value = Source[value],
fnGetWorkspaceUsers = Table.FromList(value, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in fnGetWorkspaceUsers

 

At the end it's boiling down to the question how to authenticate. "Organizational Account" gives me this message:

Annotation 2020-04-29 103927.png

Basic Authentcation returns:

Annotation 2020-04-29 103926.png

 

If it's true about what I found out that the only chance is to use a customer connector for that, this would be really bad because I don't have access to AAD in the organization and deploying a custom connector would be a hell to go through security reviews. I just want to get something I can see on the portal in Power BI! Nothing fancy! Funny enough it works with the Graph API, so I can find out AAD users and groups... 

 

Thanks,

 

 

Thomas

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.