cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tripleacoder Regular Visitor
Regular Visitor

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?

1 ACCEPTED SOLUTION

Accepted Solutions
tripleacoder Regular Visitor
Regular Visitor

Re: Power BI REST API gives 403 error

It seems I found the hidden setting:

 

https://community.powerbi.com/t5/Service/Manage-Permissions-in-Power-BI-Service/td-p/322832

 

Apparently, the dataset in the workspace requires the user to be added with "Manage permissions"...

After I did that, the error disappeared.

 

Very illogical, since Manage permissions seems to be related to sharing...

View solution in original post

7 REPLIES 7
tripleacoder Regular Visitor
Regular Visitor

Re: Power BI REST API gives 403 error

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

tripleacoder Regular Visitor
Regular Visitor

Re: Power BI REST API gives 403 error

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)"}
}
Highlighted
tripleacoder Regular Visitor
Regular Visitor

Re: Power BI REST API gives 403 error

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...

tripleacoder Regular Visitor
Regular Visitor

Re: Power BI REST API gives 403 error

Why doesn't the user have access to the group/workspace? I have made it owner/admin...

 

Also, I get the same error when instead of retrieving a dataset id,  I try to create a new dataset in the same group.

 

Is it necessary to make the user Power BI Service Administrator?

v-jiascu-msft Super Contributor
Super Contributor

Re: Power BI REST API gives 403 error

Hi @tripleacoder,

 

1. Which API exactly is it?

2. Which token did you send with the request? Is it the one starts with "eyJ0e" or the one starts with "H4sIAAA"? It should be the former.

3. Are there any other message about the error?

 

Best Regards,

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
tripleacoder Regular Visitor
Regular Visitor

Re: Power BI REST API gives 403 error

It seems I found the hidden setting:

 

https://community.powerbi.com/t5/Service/Manage-Permissions-in-Power-BI-Service/td-p/322832

 

Apparently, the dataset in the workspace requires the user to be added with "Manage permissions"...

After I did that, the error disappeared.

 

Very illogical, since Manage permissions seems to be related to sharing...

View solution in original post

v-jiascu-msft Super Contributor
Super Contributor

Re: Power BI REST API gives 403 error

Thanks for sharing. I'm glad you solved it.

 

Best Regards,

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Users Online
Currently online: 155 members 1,874 guests
Please welcome our newest community members: