Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
While runing below script in power shell i am receiving 401 error using service principal
For tracing the error i ran the command Resolve-PowerBIError -Last and i got the complete error detail as shown below
Service principal having below API permissions
In Power BI admin portal under tenant settings we have enabled below options also
I think all the required API premissions and options enabled in tenant settings but i am still receiving the 401 error. Could anyone help me on this issue. Thanks in advance!
Hi @Anonymous ,
Way1:You may check if you call an admin API as a regular user without admin rights? As expected, PowerShell will display an error message informing you that the call was unauthorized
You can refer to the following link:
Working with PowerShell in Power BI | Microsoft Power BI Blog | Microsoft Power BI
Way2: Which way do you use for authentication, maybe it’s affected by your authentication.
You can refer to the following link:
Solved: Power Bi REST API - 401 Authorization error when u... - Microsoft Power BI Community
Best Regards,
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
On the Allow Service Principal to use Power BI APIs, it says "enabled for the subset of the organization". You can specify security groups in their which are allowed to use the REST APIs. Is your service principal laying in such a security group?
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
| Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
| Also happily accepting Kudos 🙂 |
| Feel free to connect with me on LinkedIn! | |
| #proudtobeasuperuser | |
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.