Showing results for 
Search instead for 
Did you mean: 
New Member

Adding user to PowerBI pipeline with a service principal displays a 401 error


The post method is used, which returns 401, but the permissions it needs have already been given

Helper I
Helper I

Hey @Sen could you elaborate more your question? For instance, can you specify the parameters of your request? How you are authenticating to PBI API? 

Hi @lmarangio ,I use the service principal to obtain a token through the OAuth2 protocol for PowerBI authentication.


Then use Power BI REST APIs to add user to the pipeline user, but the addition fails.
Rest API link:

Are you using the following body in the request?

  "identifier": "object_id",
  "accessRight": "Admin",
  "principalType": "App"

"object_id" in your case should be "self.sp_id".



yes, refer to Powerbi's REST API, I think it's due to insufficient permissions, but I don't know what additional permissions are needed



Hey @Sen, I think that's the problem! You are requesting a token to authenticate as a service principal. But then, reading the body of you request, you are trying to authenticate as a user.


Try to use the following body I alredy reported before:

  "identifier": "object_id",
  "accessRight": "Admin",
  "principalType": "App"

Try the request with Postman and please post the results here (screenshot of the requeste response)! 

Careful, there is a huge difference between using as "principalType", "User" or "App".

Helpful resources

PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.