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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
sergiocascales
Frequent Visitor

get reports from power bi api

Hello 

I want to get reports of my power bi by api

 

I do this steps:

- Create new app and grant permisions 

sergiocascales_0-1684945615827.png

 

- Create new certificate

sergiocascales_1-1684945719009.png

 - Doing the call from postman WITH Directory (tenant) ID (otherwise get 404) and get token

sergiocascales_2-1684945817117.png

 

When put the token and call {{pbi-base-url}}/groups/:group_id/reports get 401:

sergiocascales_3-1684945983952.png

 

I can't use user-password call because have two factor authentication

 

What am I doing wrong? Am I missing a step?

 

Thanks

 

1 ACCEPTED SOLUTION

Hi Sergio,

It's in the PowerBI portal (https://app.powerbi.com)

bhalicki_0-1686728889955.png

bhalicki_1-1686728942006.png

The portal has changed since I posted the original response, but I think you just need to click the three dots, then there should be a link to update the workspace access.  You need to add the service principal (the application).

Let me know if you are still stuck.

I managed to get the API working, although it is next to useless for what I wanted to do 🙂

 

View solution in original post

5 REPLIES 5
bhalicki
Helper II
Helper II

Hi @sergiocascales ,

Hoping this might help you...

If you have managed to get a token (using service principle(application ID) and client_id), then you need to go into PowerBI Admin centre and enable the option 'Allow service principals to create and use profiles' ("Settings -> Governance and insights -> Admin portal -> Tenant settings -> Dataset Execute Queries REST API"). 

bhalicki_0-1685144845508.png


Then, you will need to grant the service principle access to the workspaces.
Workspace -> Manage Access

bhalicki_1-1685144937574.png


Then if you use the API (https://api.powerbi.com/v1.0/myorg/groups/), the workspace should be visible. 

Have a look at this link:

https://learn.microsoft.com/en-us/power-bi/developer/embedded/embed-service-principal

Hope that helps.

Kind regards,

 

Ben.

Hello

 

where i can find "Workspace -> Manage Access"?

 

In BI I see

sergiocascales_0-1685626768929.png

 

 

And in azure

sergiocascales_1-1685626804444.png

 

Hi Sergio,

It's in the PowerBI portal (https://app.powerbi.com)

bhalicki_0-1686728889955.png

bhalicki_1-1686728942006.png

The portal has changed since I posted the original response, but I think you just need to click the three dots, then there should be a link to update the workspace access.  You need to add the service principal (the application).

Let me know if you are still stuck.

I managed to get the API working, although it is next to useless for what I wanted to do 🙂

 

bhalicki
Helper II
Helper II

Hi @sergiocascales ,

 

I don't have the answer unforunately (I came here for a solution and have exactly the same problem as you).

This is what I noticed:

- There is a website where you can try the PowerBI APIs

- It gives you a BEARER token (JWT)

- If you use a JWT decoder (https://jwt.io), the contents give a random app_id that doesn't appear to be part of my tenant, and scopes that I haven't granted (but seem necessary).

- Decoding the token based on your approach doesn't seem to have the correct scope information embedded.

 

From what I have read, you should be able to authenticate without username/password (as this requires MFA), but with the app_id & client_secret approach.

Hoping someone could link to a working guide (using Postman), or Microsoft documentation (in English please ;).

sergiocascales
Frequent Visitor

CAn update the post? Anyway... I add the redirect url too: 

sergiocascales_0-1684946413656.png

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

Top Kudoed Authors