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

Join us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered

Reply
Anonymous
Not applicable

Power BI API using Service Principal

Hi, I am not sure if this is the right category to post since i am not a Fabric user but only Power BI. if not, my bad 😂

i am trying to use Power BI API via Service principal. i've given delegated permissions to the service principal and also enabled all the settings in Power BI's Admin Portal setting relevant. details as below:

 

- APIs

    - Got my token as following to 'https://api.powerbi.com/v1.0/myorg/groups/{group_id}/datasets/{dataset_id}/refreshes'    (get)

    - Get Power BI Dataset Refresh history

      : 'https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token'    (post)

    - GET Sharepoint Data

      :' https://accounts.accesscontrol.windows.net/[Tenant-ID]/tokens/OAuth/2'   (post)

  

 

- Power BI Workspace : Added a security group the service principal is in as Admin. in case it might help, i also added the service principal itself as admin, too...

 

 

- Delegated permission

  <Power BI>

    - Dataset.readwrite.all

    - Item.Excute.ALL

    - Item.ExternalDataShare.ALL

    - Item.ReadWrite.ALL

    - Item.Reshare.ALL

    -App.Read.All

 

 <Sharepoint>

   - AllSites.Read

   - AllSites.Write

 

 

The thing is that even all these settings added and enabled, i still get errors,,,, is anyone know how i can resolve this?

minhee_2-1729125621363.png

 

minhee_0-1729125455286.pngminhee_1-1729125457985.png

 

 

 

P.S. I succeeded testing the same senario in Different Tenant. therefore, it could be something to do with conditional access? 

 

Regards,

Thank you.

 

5 REPLIES 5
Anonymous
Not applicable

Hi, @Anonymous 

Thanks for the reply from FabianSchut and frithjof_v, FabianSchut gave the suggetions, you can check it.

Best Regards,
Yang

Community Support Team



Anonymous
Not applicable

Hi @FabianSchut,

The bearer token was obtained using the clien_sercet method. and I use scope 'https://analysis.windows.net/powerbi/api/.default'

minhee_0-1729210668786.png

 

Hi @Anonymous,

 

Those are indeed the correct settings. Are you sure that the service principal is added as a member in the security group app-test-mhkim (the security group that is able to use APIs)? And just to be sure, in your screenshot you have unapplied changes for the admin API settings. Did you apply them afterwards?

frithjof_v
Super User
Super User

Just want to mention:

 

When you are using service principal (or more precisely: client credentials flow), the delegated permissions have no effect. So it's not necessary to setup any delegated permissions when you will use the service principal authentication (more specifically, client credentials flow).

 

What matters, is what permissions you give the service principal inside the Power BI portal (Fabric).

 

https://learn.microsoft.com/en-us/answers/questions/2039779/service-principal-doesnt-respect-delegat...

 

https://community.fabric.microsoft.com/t5/General-Discussion/Power-BI-Rest-API-Delegated-permissions...

 

https://www.reddit.com/r/PowerBI/s/ZhJFNHA7vM

FabianSchut
Super User
Super User

Hi @Anonymous,

 

What method do you use to get the Bearer token? Do you use the client_id & client_secret version? What is the scope you are using while retrieving the Bearer token?

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June FBC25 Carousel

Fabric Monthly Update - June 2025

Check out the June 2025 Fabric update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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