Forum Discussion

tripleacoder's avatar
tripleacoder
Icon for Helper I rankHelper I
7 years ago
Solved

Power BI REST API gives 403 error (User does not have access to group)

I am trying to use the Power BI REST API with a "Power BI master account" - meaning a user account for the "app owns data" scenario.

The account has a Power BI Pro license and is a member of the workspace I am trying to read from.

 

I have also made the account the owner of the app registration for my app.

 

I can get a token, but when I call the API to get a data set id from the workspace, I get 403 (Forbidden).

 

The same program works if I use my personal credentials.

What am I missing?

7 Replies

  • I have promoted the account to Owner/Admin of the workspace, but it doesn't seem to have helped.

    • tripleacoder's avatar
      tripleacoder
      Icon for Helper I rankHelper I

      Using the following code:

       

       

      System.Net.WebException ex;
      
      
      
      Stream stream = ((System.Net.HttpWebResponse)(ex).Response).GetResponseStream();
      using (StreamReader sr = new StreamReader(stream))
      {
           string text = sr.ReadToEnd();
      }

       

       

      I was able to extract more detailed error information from the exception:

       

      {"error":
      {"code":"Unauthorized","message":"User(<ii>76e423fd-314d-42ff-ab23-306f25c46aea</ii>) does not have access to Group(<ii>2c6f2b64-162d-40c8-934e-44e3075c5ee8</ii>) with Permissions(ReadWrite)"}
      }
      • tripleacoder's avatar
        tripleacoder
        Icon for Helper I rankHelper I

        This is the scope part of the decoded token (which doesn't work):

         

        scp"Dataset.ReadWrite.All Workspace.ReadWrite.All",

         

         

        This is the same part, when using my own credentials (which works):

         

        scp"Dataset.ReadWrite.All Workspace.ReadWrite.All",

         

        They are equal...