Forum Discussion
Admin API for Service principle
Hi soldous Anonymous ,
Did you get this to work?
I'm having a similar problem. I'm able to get an access token and use that on the api's, except when I use it on the admin api's I get the 401 unauthorized error.
I've registered an app and granted all the reading scopes this includes the Tenant.Read.All scope for Application
The app is member to a security group which is added in the Power BI portal to use the api's
On top of that I've asked our global admin to make our service principal a Power BI admin.
In order to get a token I have to use the Tenant specific endpoint:
https://login.microsoftonline.com/{TenantID}/oauth2/v2.0/token
with the body:
grant_type=client_credentials
&client_id={client_id}
&response_type=code
&scope=https://analysis.windows.net/powerbi/api/.default
&state=12345
&client_secret={client_secret}
Any help is much appriciated