Forum Discussion

sasdfasdfsad's avatar
sasdfasdfsad
Advocate IV
1 year ago
Solved

PowerShell Requires PBI Admin to work? Get-PowerBIWorkspace

I want to use Get-PowerBIWorkspace to iterate through the users in my workspaces.  

When I try to use the command, including specifying one of the workspaces I am workspace admin in, I still get an unuthorized error message.

Get-PowerBIWorkspace : Operation returned an invalid status code 'Unauthorized'
At line:1 char:1
+ Get-PowerBIWorkspace -Id 8b416040-0dc6-46c4-b784-6e45ba0a239e
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (Microsoft.Power...owerBIWorkspace:GetPowerBIWorkspace) [Get-PowerBIWorkspace], HttpOperationException
    + FullyQualifiedErrorId : Operation returned an invalid status code 'Unauthorized',Microsoft.PowerBI.Commands.Workspaces.GetPowerBIWorkspace
 


I an NOT global Power BI admin, our organization is too large for that.  We simply create workspaces and grant people admin rights to them as needed.

Is there anyway to use the Power BI PowerShell modules without being a global PBI Admin?

  • Hi sasdfasdfsad ,

     

    Unfortunately not, there's only 2 scope Individual and Organizational. Individual scope gives access to entities that current user has. For organizational scope, it has to be admin account to check entities across organization. 

    https://github.com/microsoft/powerbi-powershell

     

    If this post helps, please accept this as a solution. Appreciate your kudos.

    Thanks,

    Pallavi

     

    Thanks,

    Pallavi

3 Replies

    • sasdfasdfsad's avatar
      sasdfasdfsad
      Advocate IV

      Very good question, I should have included that

      Login-PowerBIServiceAccount

      then when that came back successfully
      Get-PowerBIWorkspace

      which returned the error message

      However,

      I just tried
      Login-PowerBI

      and while it authenticates fine, I still get the same error when I issue the 
      Get-PowerBIWorkspace 
      command.

       

      PS C:\Users\OITCOFloryJ> Get-PowerBIWorkspace 
      Get-PowerBIWorkspace : Operation returned an invalid status code 'Unauthorized'
      At line:1 char:1
      + Get-PowerBIWorkspace
      + ~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : WriteError: (Microsoft.Power...owerBIWorkspace:GetPowerBIWorkspace) [Get-PowerBIWorkspace], HttpOperationException
          + FullyQualifiedErrorId : Operation returned an invalid status code 'Unauthorized',Microsoft.PowerBI.Commands.Workspaces.GetPowerBIWorkspace
  • Hi sasdfasdfsad ,

     

    Unfortunately not, there's only 2 scope Individual and Organizational. Individual scope gives access to entities that current user has. For organizational scope, it has to be admin account to check entities across organization. 

    https://github.com/microsoft/powerbi-powershell

     

    If this post helps, please accept this as a solution. Appreciate your kudos.

    Thanks,

    Pallavi

     

    Thanks,

    Pallavi