I want to query the Power BI dataset using Power BI REST API, app to app authentication (Service Principal). I am getting Error 403 (access forbidden) when sending request to Power BI dataset.
I have:
- Azure AD App registered
- SP with **Dataset.Read.All **delegated permission
- SP added to AAD security group
- the security group is allowed to use Power BI API (setting under Tenant enabled)
- the security group has Admin role in Power BI Service workspace. I am able to generate the access Token successfully. but then I am getting Error 403 (access forbidden) when sending request to Power BI dataset using GET or POST method, for example:
GET https://api.powerbi.com/v1.0/myorg/groups/{{group_id}}/datasets Authorization: Bearer Token
Can anyone help on that, what is missing here, thank you.
In my case, I got
403 Forbiddenerror when I tried to query the data set with token generated with invalid scope:Response:
I created one AAD security group and added
PowerBI Appservice principal to it like this:Now, I allowed this group to call Power BI API by adding it under below option in Admin portal:
Make sure to grant access to either the service principal or security group for your Power Bi workspace:
Now, I generated access token using client credentials flow via Postman with below parameters:
Response:
When I used this token to query dataset, I got response successfully like this:
Response:
Reference: Embed Power BI content with service principal and an application secret - Power BI | Microsoft