Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Power BI report pages in group REST API returns a 401 unauthorized for some reason

I have a service principal which has viewer access to a single workspace. In the workspace, one of my reports uses a dataset from another workspace the service principal doesn't have access to. I'm able to successfully query the report from the reports in group api (https://learn.microsoft.com/en-us/rest/api/power-bi/reports/get-reports-in-group)

But when using the get pages in group api (https://learn.microsoft.com/en-us/rest/api/power-bi/reports/get-pages-in-group)I get a 401 unauthorized error. 

 

Is there any documentation for this behavior? Why do the report pages return a 401 unauthorized in this case but not reports? I believe this is a bug and this seems to be how to report bugs, but let me know if there's another way.

Status: Needs Info

Hi @brittaf2002 

You mean, you don't have access to a report from another workspace, but you can get this report through the API, but when you use the API to get the page of this report, there is a 401 error reported, right? 

I compared the two APIs , and the requirements for permissions are the same, so I can't see a specific difference just from the documentation. Can you provide the content of your API and the results returned?

 

Best Regards,
Community Support Team _ Ailsa Tao

Comments
v-yetao1-msft
Community Support
Status changed to: Needs Info

Hi @brittaf2002 

You mean, you don't have access to a report from another workspace, but you can get this report through the API, but when you use the API to get the page of this report, there is a 401 error reported, right? 

I compared the two APIs , and the requirements for permissions are the same, so I can't see a specific difference just from the documentation. Can you provide the content of your API and the results returned?

 

Best Regards,
Community Support Team _ Ailsa Tao

brittaf2002
Frequent Visitor

 

"You mean, you don't have access to a report from another workspace, but you can get this report through the API, but when you use the API to get the page of this report, there is a 401 error reported, right? "

 

@v-yetao1-msft  No, what I mean is I have a report in a workspace which the service principal has access to, but the report is using a dataset from a different workspace which the service principal does not have access to. I do not get a 401 error for the report that is correct, but I get a 401 error for the report pages also correct. 

 

"I compared the two APIs , and the requirements for permissions are the same, so I can't see a specific difference just from the documentation."

 

@v-yetao1-msft I also did not see any permissions requirements differences, it seems like a bug to me. I also couldn't find another place to report bugs, is this the right place or is there somewhere else?

 

"Can you provide the content of your API and the results returned?" 

 

Sure these are run using postman and the workspace the service principal has access to. (The service principal has Viewer access to eb498bc7-f2ad-4a9b-b053-5e1b8889a97f but has no access to workspace id aefbded1-035e-4a53-844f-89daae88b1e0):

 

Get reports for group (removed other reports from response which were not relevant to this test): 

https://api.powerbi.com/v1.0/myorg/groups/eb498bc7-f2ad-4a9b-b053-5e1b8889a97f/reports/  

 

Status 200 OK

Body: 

{
"value": [
{
"id": "3ae5c2ea-8e67-4d95-9685-5aa3a64fecf6",
"reportType": "PowerBIReport",
"name": "Test Report",
"isFromPbix": false,
"isOwnedByMe": false,
"datasetId": "47825345-20fd-4e94-96a0-d3b6d3faee84",
"datasetWorkspaceId": "aefbded1-035e-4a53-844f-89daae88b1e0",
"users": [],
"subscriptions": []
}
]
}

 

 

 

Get pages: 

 https://api.powerbi.com/v1.0/myorg/groups/eb498bc7-f2ad-4a9b-b053-5e1b8889a97f/reports/3ae5c2ea-8e67...  

 

Status: 401 Unauthorized

Body: 



{
"error": {
"code": "PowerBINotAuthorizedException",
"pbi.error": {
"code": "PowerBINotAuthorizedException",
"parameters": {},
"details": [],
"exceptionCulprit": 1
}
}
}

 

 

 

 

If I add the service principal to the worspace with id 

aefbded1-035e-4a53-844f-89daae88b1e0 then a single page is returned, like this: 

{
"value": [
{
"name": "ReportSection",
"displayName": "Page 1",
"order": 0
}
]
}
 

 

 

brittaf2002
Frequent Visitor

Note, an issue has been raised with microsoft support and they are looking into it. So this can be ignored.