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.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Kudoed Authors