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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
lgordon
Frequent Visitor

API authentication issue with executeQueries API - 401 Unauthorized

Getting 401 Unauthorized response on specific dataset. Do not appear to have issues querying other datasets. Able to refresh target dataset without issue.

 

scope: Dataset.ReadWrite.All

 

Error response:

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

 

2 REPLIES 2
v-jianboli-msft
Community Support
Community Support

Hi @lgordon ,

 

Before you take this new REST API for a test spin, note that the tenant-level setting Allow XMLA endpoints and Analyze in Excel with on-premises datasets must be enabled in the Power BI admin portal, as depicted in the screenshot below. 

vjianbolimsft_0-1666246627599.png

Equally important and also consistent with XMLA read access, you need the Build permission for the dataset you want to query by using this new REST API. Contributors and workspace admins have this permission, but you can also grant it directly, as in the following screenshot. For more information, see Build permission for shared datasets. Also note that the workspace must be a modern (v2) workspace. Classic (legacy) workspaces are not supported. So, if your datasets still reside in a classic workspace, make sure you upgrade the workspace to the new (v2) workspace experience.

 

Besides, please consider about some limitations:

 

  • 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.
  • The tenant setting Dataset Execute Queries REST API, found under Integration settings, must be enabled.
  • Service Principals aren't supported for datasets with RLS per RLS limitations or with SSO enabled. To use Service Principals, make sure the admin tenant setting Allow service principals to user Power BI APIs under Developer settings is enabled.

For more details, please refer to:

Datasets - Execute Queries - REST API (Power BI Power BI REST APIs) | Microsoft Learn

Announcing the public preview of Power BI REST API support for DAX Queries | Microsoft Power BI Blog...

 

Best Regards,

Jianbo Li

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

 

Hello

 

As I mentioned, I am able to query other datasets with this api, just not this specific dataset. This dataset is a composite dataset that does have a DQ over AS partition which is querying another dataset in PBI service -- which as I understand is not the same as Azure Analysis Services. I don't see any written limitation indicating this.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.