Forum Discussion

rafal_walisko's avatar
3 years ago

Giving access to personal workspace.

Hi, I need to add access to myself to few personal workspaces.

I can do it from Service via Workspaces then I filter out workspaces that I need and I click get access

 

 

However I want to do this by powershell cmdlets for powerbi. 

Add-PowerBIWorkspaceUser I get the message 
 

 

 

Add-PowerBIWorkspaceUser : Operation returned an invalid status code 'Unauthorized'​

 

 

Everything is done by the same account with Powerbi admin rights

1 Reply

  • MAwwad's avatar
    MAwwad
    Icon for Solution Sage rankSolution Sage

    If you're getting a "Unauthorized" error when using the Add-PowerBIWorkspaceUser cmdlet, it could be due to a lack of permissions or an issue with the authentication.

    Here are some steps you can take to resolve the issue:

    1. Make sure that the account you're using to run the cmdlet has Power BI admin rights, as well as the necessary Azure Active Directory (AAD) permissions.

    2. Check that the account has been added as an administrator in the Power BI admin portal (https://admin.powerbi.com/).

    3. Make sure that the account has been granted the appropriate role in Azure AD (e.g., Global Admin, Power BI Service Admin).

    4. Try to run the cmdlet in a new PowerShell session, as the error could be caused by a cached token or other session-specific issues.

    5. If you're still having trouble, try to re-authenticate to Power BI using the Connect-PowerBIServiceAccount cmdlet and provide the necessary credentials.

    By following these steps, you should be able to resolve the "Unauthorized" error and add yourself to the personal workspaces using the Add-PowerBIWorkspaceUser cmdlet.