Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi All,
I am trying to execute a query in a notebook in Fabric using the Power BI rest.
Datasets - Execute Queries In Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn
I have successfully retrieved an access token and I am able call operations such as get dataset but when I try to perform an execute query operation I get an 401 unauthorized error. Both my service principal and the API has acces to the dataset and "Semantic Model Execute Queries REST API" is enanbled in the tenant settings. Are there any other permissions I should be aware of?
Get datasets works perfecty:
header = {'Authorization': f'Bearer {access_token}'}
Execute queries returns unauthorized access:
Hi @mohitkumawat and @ibarrau
Thanks for your inputs. The service principal has build permissions and the model does not have RLS.
I have tried to create a new plain semantic model in the same workspace with no data sources. I am able to execute queries using the api for this dataset, but as soon as I added a data source (dimension tables from another workspace) I cannot execute queries anymore. Could it be due to missing permissions in the workspace with my data source?
The words "Added a data source (dimension tables from another workspace) sounds like a live connection or composite with direct query. I don't think that's supported. If you can execute queries with one dataset and you can't with another. Then it's permissions or limitation with the semantic model. Usually this works against import models, so data sources shouldn't be a problem. The permissions would be "build for a semantic model".
I hope that make sense.
Happy to help!
Remember that for composite models the user needs to have "registered/installed" each of the participating apps.
Hi. As mohitkumawat says, check the permissions at the registered app and make sure the service principal has build permissions.
In addition to his comment, check the limitations. https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/execute-queries-in-group#limitations
One that can make a problem here is using service principal to execute a query to a semantic model that has RLS. That can't be done for example. Try running simple evaluates to more than one workspace just in case the one you are querying has an issue.
I hope that helps,
Happy to help!
Hi,
please check your App has added in worskpace as admin and provide deligated permission to the App of Dataset.ReadWrite.All or Dataset.Read.All.
The user must have dataset read and build permissions. For more information, see Manage dataset access permissions.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.