Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
I am having trouble executing the "ExecuteQueries In Group" PowerBI API for Datasets.
Here's what I did:
Microsoft Entra ID:
1. Create an App Registration with the name "PowerBI-SP".
2. Created a Client Secret with extended validity. Using the secret value as the client secret.
2. Added the following Delegated API Permissions with no admin consent required: "Dataset.Read.All Dataset.ReadWrite.All"
3. Created a MS Entra Security Group with the name "Group For PowerBI SPs".
4. Added App Registration "PowerBI-SP" as the member of the MS Entra Security Group "Group For PowerBI SPs".
PowerBI Admin Portal:
1. Under "Integration Settings", enabled the "Dataset Execute Queries REST API" option.
2. Applies to "the entire organization". No need to whitelist my MS Entra Security Group.
3. Under "Developer Settings", enabled the "Allow Service Principals to use the PowerBI/Fabric APIs" option.
4. Applies to "Specific Security Groups" with my MS Entra Security Group "Group For PowerBI SPs" whitelisted.
Fabric/PowerBI Service:
1. Added my MS Entra Security Group "Group For PowerBI SPs" as the "Member" of the workspace that I am trying to read the data from.
2. Gave the MS Entra Security Group "Group for PowerBI SPs" the access of "read, build" permissions on the dataset/semantic-model that I am trying to query the data from, using DAX.
Generate Access Token:
1. Token Endpoint V2: https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token
2. Content-Type: x-www-form-urlencoded
3. Request Body: client_id={client_id}&client_secret={client_secret}&grant_type="client_credentials"&scope="https://analysis.windows.net/powerbi/api/.default"
ExecuteQueries in Group API: Datasets - Execute Queries In Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn
1. Endpoint: https://api.powerbi.com/v1.0/myorg/groups/{group_id}/datasets/{dataset_id}/executeQueries
2. Authorization: "Bearer {access_token}"
3. Request Body: A valid Json with a valid DAX.
Example: "{
"queries": [
{
"query": "EVALUATE VALUES(MyTable)"
}
],
"serializerSettings": {
"includeNulls": true
}}"
Response:
ERROR: 401 Unauthorized
Solved! Go to Solution.
Issue confirmed! Analysis Services connections are causing the API to fail. These connections are basically created to connect to other datasets in the same premium workspace.
Regards
Take your access token and run it through jwt.io - most likely your scope request Dataset.Read.All didn't make it through.
@lbendlin That's right. There wasn't an "scp" claim in the token.
1. But it must be noted that the same token is able to query the data using DAX from a "My Workspace" using "ExecuteQueries (Not Group) API" where the SP has "read, build" permissions on the dataset.
2. I also uploaded another semantic model, a very basic one to my dataset under the same premium workspace from where I have not been successful in querying the data, as highlighted in the question. I decided to remove "Member" permission entirely from the Workspace for my MS Entra ID Security Group "Group for PowerBI SPs" and gave direct access to my MS Entra ID Security Group on the new semantic model or the dataset with "read, build" permissions. And it worked!! with "ExecuteQueries (Not Group) API" even without "scp" claim in the token.
Now I wonder if the semantic model which I am not able to query, is the problem here... Need to investigate further.
In the meantime, I would really appreciate it if you could please elaborate on any remedies regarding the "scp" claim that could be of help here. Thanks!
@lbendlin I think I found the issue!
Most of our Semantic Models has a live "Analysis Services" connection to a common Semantic Model in the same premium workspace. As per the limitations of the ExecuteQueries API, both Group and Non Group,
"Datasets that are hosted in Azure Analysis Services or that have a live connection to an on-premises Azure Analysis Services model aren't supported".
Datasets - Execute Queries - REST API (Power BI Power BI REST APIs) | Microsoft Learn
Datasets - Execute Queries In Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn
Neither our dataset has a live connection to the on-prem azure analysis services model, nor any of our datasets hosted in Azure Analysis Services.
But as we all know, the underlying engine of PowerBI service workloads uses Analysis Services which is not so different from Azure Analysis Services, if I remember correctly. And maybe that's why I get "PowerBINotAuthorized" exception only for those datasets that have "Analysis Services" live connection to another dataset in the same workload.
Thoughts?
Did you give build access through the app or through the workspace? App set to auto install?
Issue confirmed! Analysis Services connections are causing the API to fail. These connections are basically created to connect to other datasets in the same premium workspace.
Regards
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
6 | |
6 | |
3 | |
2 | |
2 |