Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Error assigning premium capacity to workspace - PowerBINotAuthorizedException

Hi all, 

 

I am encountering an error while attempting to assign premium capacity to the workspace in Power BI. I am using a service principal admin app with Python and REST API to create the workspace and then assign the capacity. However, when I try to assign the workspace, I receive the following error message:

 

{"error":{"code":"PowerBINotAuthorizedException","pbi.error":{"code":"PowerBINotAuthorizedException","parameters":{},"details":[],"exceptionCulprit":1}}}.

 

I have already checked that I have the "Capacity.Readwrite.All" and "Workspace.ReadWrite.All" API permission, and the workspace is successfully created when I run the python script.

 

I suspect that there might be additional steps or permissions required to assign the workspace to the capacity. Any help or guidance on resolving this issue would be greatly appreciated.

 

Thank you 

 

Regards,

Shreenath 

 

@lbendlin @Greg_Deckler @Kaviraj11 @dm-p

Need Help guys

  • Anonymous's avatar
    Anonymous
    2 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! 

11 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    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's avatar
    Greg_Deckler
    Community Champion

    Anonymous First question I would have is whether or not you can go into the Service and manually assign the workspace to the premium capacity.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Greg_Deckler yes, am able to assign premium license capacity to a workspace from the PBI online service. Just doesn't work via the API call.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Yes I can but in my code im using service principle to assign capacity.  This service principle has Capacity.Readwrite.All and Workspace.Readwrite.all API Permission and also it has been added to admin Security Groups. Im able to create Workspace using this service principle but not assign capacity. 

    • Greg_Deckler's avatar
      Greg_Deckler
      Community Champion

       It seems from this that there is an a Capacity Assignment permission. It also specifies to use the service principal object ID: Move your Power BI embedded analytics app to production - Power BI | Microsoft Learn


      Assign a workspace to a capacity by using a service principal
      To assign a workspace to a capacity by using a service principal, use the Power BI REST API. When you're using the Power BI REST APIs, make sure to use the service principal object ID. The service principal should have administrator permissions for the workspace and capacity assignment permissions for the capacity.

       

      Anonymous

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Greg_Deckler 

        Thanks for your reply. I am using REST API to create workspace and assign capacities. As you have mentioned I have already added the service principal to my workspace (as admin). Regarding the service principal having permissions to assign capacity or not, how can I check this ? Where can I assign this permission ?

        Thanks