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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Benedikt_Sch
Helper I
Helper I

Power BI Admin API access with client secret no access to the admin side

Hey Guys,

 

i try to generate a bearer token i order to get data from admin api. I am able to generate a token but it is only working in normal api calls not on admin calls.

Steps i have done:

  • register Azure app
  • Grant permissions and AdminConsent
  • Create SecurityGroup and add app as Member
  • add Group in Power Bi to Api and Admin Api

 

This works:

 

let
    Source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg",
    [
      RelativePath =  "/groups" , 
 Headers=[Authorization=
 
  "Bearer " & #"GET AccessToken (3)"()]

     ]))
in
    Source

 

this doesn't work:

 

let
    Source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg",
    [
      RelativePath =  "/admin/groups?%24top=1000" , 
 Headers=[Authorization=
 
  "Bearer " & #"GET AccessToken (3)"()]

     ]))
in
    Source

 

Error:Benedikt_Sch_0-1707837682992.png

 

When i use token that is generated by learn page from ms. The token is much longer and works also for admin api calls.

 

the token is generated by this function:

 

() as text  => 
let
tentant_id ="my tenant",
client_id = "my client",
client_secret = "my client secret",
appIDURL = "my api url",


 url = "https://login.microsoftonline.com/"&tentant_id&"/oauth2/token",


        body = " grant_type=client_credentials&
                   resource=https://analysis.windows.net/powerbi/api&
                   client_id="&client_id&"&
                client_secret="&client_secret,
                Data=Json.Document(
                             Web.Contents("https://login.microsoftonline.com/"&tentant_id&"/oauth2/token/",
                                    [ Headers=[#"Content-Type"="application/x-www-form-urlencoded"],
                                     Content=Text.ToBinary(body)
                                    ])),
         access_token = Data[access_token]
in
         access_token

 

 

 

does anyone knows where my fault is?

I searched many threads but doesn't found any solution.

 

regards Benedikt

2 REPLIES 2
rubayatyasmin
Super User
Super User

Hi, @Benedikt_Sch 

 

  1. Make sure the Azure AD application registration includes permissions specifically for the Power BI Admin API. This usually means having Tenant.Read.All or Tenant.ReadWrite.All permissions within the Power BI service permissions set. These permissions require admin consent (which you've mentioned you've already done, but it's worth double-checking).

  2.  Admin consent needs to be given at the tenant level. Sometimes, even if permissions appear to be correctly set, the consent might not have been properly applied. Revisit the admin consent process to ensure it's been granted for the permissions necessary to use the admin API.

Check the link below if you missed anything

 

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

 

Ensure that this security group is designated as a Power BI service admin group in the Power BI Admin Portal.

 

Also, Can you try refreshing or creating the secret for admin and try again? 


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


Hi @rubayatyasmin ,

 

thanks for the quick answer!

 

I double checked the mentioned points:

  • Tenant.ReadWrite.All and als other possible permissions are granted and also granded as Admin
  • API and ADMIN API in Power Bi has the sec-Group as Member
  • New secret creaded

Sadly no succes. 

I found GitHub - migueesc123/PowerBIRESTAPI: A Microsoft Power BI Data Connector or Power Query Connector fo... and this works quite good in my Case. Maybe is it the only solution here. Chris webb also mentioned that the admin API is not working in power query.

 

Thanks and best regards.

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors