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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
tcboeira
New Member

How to authenticate using a Service Principal?

Hello everyone, I hope you are all well!

 

First of all, I must say that I do not speak another language and that is why I use an online translator.

 

After extensive research and reading - which does not mean that I did it correctly - I tried several ways without success.

 

I have an application created and registered in EntraID/AzureAD, working perfectly and being used in some Scripts that automate some actions.

 

However, to use "Connect-PowerBIServiceAccount" even if I connect, the response is always the same when I want to, for example, simply use the "Get-PowerBIWorkspace -Scope Organization -All" cmdlte. 6. I always get the response "Get-PowerBIWorkspace: Operation returned an invalid status code 'Unauthorized'"

 

What caught my attention is that when I make the connection using the Application, I get the following return on the screen:
Environment: Public
TenantId:
ClientId: [MY CLIENT ID]
CertificateThumbprint: [MY CERT]
However, note that the "TenantId" is always empty.

 

However, if I do it using a username and password, it returns filled in. I don't know if this is relevant.
I imagined that this procedure would be "easier" but it hasn't been.

 

Does anyone have any idea how I can be successful?

 

Thank you very much to everyone for your attention
Hugs

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks for the reply from arvindsingh802.

 

Hi @tcboeira ,

 

According to your error information, unauthorized is usually a result of not properly configuring permissions when using the service body or not requesting the corresponding token correctly, you can follow the steps in the following document to configure your Apps, making sure that the steps are configured correctly:

Embed Power BI content in an embedded analytics application with service principal and an applicatio...

 

vlinhuizhmsft_0-1724906243302.png

 

For the issue that Operation returned an invalid status code 'Unauthorized', I found the type of issues for you, you can check this out:

Solved: Re: Unauthorised when using Get-PowerBIWorkspace - Microsoft Fabric Community

Solved: Service Principle cannot Get-PowerBIWorkspace - Microsoft Fabric Community

Get-PowerBIWorkspace : Operation returned an invalid status code 'Unauthorized' · Issue #375 · maikv...

 

Best Regards,
Zhu
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

 

View solution in original post

3 REPLIES 3
arvindsingh802
Super User
Super User

Please confirm if you are following all the setps mentioned in this article 
https://stackoverflow.com/questions/77939584/how-to-do-the-authentication-to-run-power-bi-rest-api-i... 


If this post helps, then please consider Accept it as the solution, Appreciate your Kudos!!
Proud to be a Super User!!

Yes yes yes... I'm with them indeed...

Anonymous
Not applicable

Thanks for the reply from arvindsingh802.

 

Hi @tcboeira ,

 

According to your error information, unauthorized is usually a result of not properly configuring permissions when using the service body or not requesting the corresponding token correctly, you can follow the steps in the following document to configure your Apps, making sure that the steps are configured correctly:

Embed Power BI content in an embedded analytics application with service principal and an applicatio...

 

vlinhuizhmsft_0-1724906243302.png

 

For the issue that Operation returned an invalid status code 'Unauthorized', I found the type of issues for you, you can check this out:

Solved: Re: Unauthorised when using Get-PowerBIWorkspace - Microsoft Fabric Community

Solved: Service Principle cannot Get-PowerBIWorkspace - Microsoft Fabric Community

Get-PowerBIWorkspace : Operation returned an invalid status code 'Unauthorized' · Issue #375 · maikv...

 

Best Regards,
Zhu
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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 Solution Authors
Top Kudoed Authors