cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
Sen
New Member

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

Sen_0-1683190507469.pngSen_1-1683190532426.png

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

5 REPLIES 5
lmarangio
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.

Sen_0-1687253913551.png

Then use Power BI REST APIs to add user to the pipeline user, but the addition fails.
Rest API link:  https://learn.microsoft.com/en-us/rest/api/power-bi/pipelines/update-pipeline-user

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

Sen_0-1687313555201.png

 

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

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

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!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.