Forum Discussion
Service Principal Admin API
Hi Anonymous ,
Based on my understanding, I think this is more likely to be related to the authentication access token. REST API needs authentication, did you send authentication credentials along with your request?
To get the token, please refer to Get an authentication access token .
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello,
Yes, i am passing/using the authentication token when i execute the REST API.
When i execute the non-admin API like this request "
https://api.powerbi.com/v1.0/myorg/groups" i get results
When i execute the admin API like this request "
https://api.powerbi.com/v1.0/myorg/admin/groups?%24top=5000" i get the error message
The remote server returned an error: (401) Unauthorized.
Do you need any other information ?
Thanks for your help!
- v-kkf-msft5 years agoCommunity Support
Hi Anonymous ,
The permissions required by these two APIs are different. When you execute Admin - Groups GetGroupsAsAdmin API, you must have administrator rights (such as Office 365 Global Administrator or Power BI Service Administrator) to call this API or authenticate via service principal.
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
WinnizIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous5 years agoNot applicable
Hello,
Please check again, your last comment conflicts with what is written in microsoft's documentation.
I am referring to this link
https://docs.microsoft.com/en-us/power-bi/admin/read-only-apis-service-principal-authentication
In this link it states the following.
According to your last post, the service principal needs Power BI Service Administrator role, how do we assign this to a Service Principal ?
Looking forward to your response
- v-kkf-msft5 years agoCommunity Support
Hi Anonymous ,
I don't mean to assign the administrator role to the service principal. I think the administrator role required by the API refers to the PowerBI account you use when calling the API.
You can test with different PowerBI accounts on Admin - Groups GetGroupsAsAdmin , like this:
This is the test result when I use a normal user (no administrator privileges), it returns 401 errors.
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
WinnizIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.