DevScope/powerbi-powershell-modules

New-PBIGroupUser error when using -groupUserAccessRight Member

aaronu7 opened this issue · 3 comments

Command:
New-PBIGroupUser -authToken $token -groupId $groupId -emailAddress $email -groupUserAccessRight Member

Error:
Invoke-PBIRequest : The remote server returned an error: (400) Bad Request. -
'{"error":{"code":"UnsupportedAccessRightError","pbi.error":{"code":"UnsupportedAccessRightError","parameters":{},"details":[]}}}'
At C:\Program Files\WindowsPowerShell\Modules\PowerBIPS\2.0.1.3\PowerBIPS.psm1:501 char:12

  • ... $result = Invoke-PBIRequest -authToken $authToken -method Post -res ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Write-Error], WebException
    • FullyQualifiedErrorId : System.Net.WebException,Invoke-PBIRequest

Mind the "Note:" on https://docs.microsoft.com/en-us/rest/api/power-bi/groups/addgroupuser

API Version: v1.0
Grants the specified user permissions to the specified workspace.
Note: Only Admin access right is supported.

fmms commented

Why does this restriction exist? Is there any work around?

Not tested yet, but they told me that using workspace V2 should work:

https://docs.microsoft.com/en-us/rest/api/power-bi/groups/creategroup
POST https://api.powerbi.com/v1.0/myorg/groups?workspaceV2={workspaceV2}