Forum Discussion
Error assigning premium capacity to workspace - PowerBINotAuthorizedException
- Anonymous2 years ago
Greg_Deckler Anonymous : Thank you all for the response. I have successfully resolved the issue by ensuring that the premium capacity had the necessary contributor permissions. After doing so, my Python code was able to assign the capacity. I would like to express my thank you to you both.
Screenshot attached here :
To assign the necessary permissions, go to Power BI Admin, navigate to Capacity, and select the Premium Capacity and then go to the Contributor option. In this step, make sure to specify the correct security group name, as we had security groups in place..
In the future, if anyone works with a Service Principal Admin, I would recommend considering this parameter as well.
Thank you!
Greg_Deckler Hi,
We have PowerBi Premium Capacity and I tried to add, but i'm unable to add a ServicePrinciple or a Security Group in there. looks like it works only for individual users. Do you know how to add a ServicePrinciple ?
Thanks in advance.
Thanks for the reply from Greg_Deckler , please allow me to provide another insight:
Hi, Anonymous
Regarding adding a service principal to a workspace, my solution is as follows:
First, if you're an administrator, check that your following switches are on:
Second, add normally:
You can also use PowerShell to add it, here's a screenshot of the official documentation for the content:
Here is the relevant documentation:
Embed Power BI content in an embedded analytics application with service principal and an application secret - Power BI | Microsoft Learn
Automate Power BI Premium workspace and semantic model tasks with service principals - Power BI | Microsoft Learn
Of course, if you have any new ideas, you are welcome to contact us.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous2 years agoNot applicable
Anonymous : Thank you for the reply.
I had added service principal as admin to the workspace, and from what you mentioned above I have also enabled settings in the PowerBI Admin portal.
However when I try to run this API call, I get this error -
"pbi.error":{"code":"PowerBINotAuthorizedException","parameters":{},"details":[],"exceptionCulprit":1}
What am I missing ?Thanks in advance !- Anonymous2 years agoNot applicable
HI,Anonymous
Thanks for the quick reply.
Has the problem been solved? If it does, share your solution and accept it as a solution that will help other community members who have the same problem as you.
In response to your question, based on the information I've gathered, you can try the following:
1.First, you can try adding the service principal to the security group and then perform a similar operation on the security group to see if that solves the problem.
Here are screenshots and links to the relevant answers:
2.Second, you can try removing the permissions granted.The access token is then decoded using a JWT token decoder to check for the presence of a key/value pair.
3.Finally, if the token still contains the value of the key/value pair, create a new app that doesn't have permissions and add it to an existing security group.
Here are screenshots and links to the relevant answers:
python - Power BI Rest API Requests Not Authorizing as expected - Stack Overflow
Of course, hopefully you will back up your important data before trying my advice to see if that solves the problem.
If you have any new ideas, you are welcome to contact us.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.