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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Error code PowerBINotAuthorizedException while using new Power BI REST APIs for DAX queries

Hi,

I have successfully started to use the new support for DAX query using Power BI Rest APIs.
However I have encountered an issue which seems to be undocumented. 
Authenticating using a service principal (AAD application) and querying a Power BI dataset which uses mixed mode (DQ to PBI dataset) returns an error 401 unauthorized PowerBINotAuthorizedException.

The very same REST API call to a dataset which does not have mixed mode, i.e. only import, works fine.

The dataset which causes issues has a DQ to a remote Power BI dataset in mixed mode. Using the New functionality DirectQuery for Power BI datasets. The very same REST API call directly to the remote dataset works OK.

The AAD App has proper API permissions for Power BI Service (Dataset.Read.All). Service principal have Admin permissions in both remote Power BI dataset workspace as well as on the workspace where the querying dataset is located.

Status: New
Comments
v-yingjl
Community Support

Hi @Anonymous ,

You could refer this document about troubleshooting: Troubleshoot your embedded application 

 

In addition, since it related to AAD application, consider whether it works in premium capacity or PPU workspace.

 

Best Regards,
Community Support Team _ Yingjie Li

 

 

sstockda
Regular Visitor

Ok - I burnt way too much time finding this out. My very first attempt at using executeQueries was to a mixed mode dataset so I was struggling thinking that I had a my service principal or client app configured incorrectly.

 

I've just tested by loading a simple import dataset into workspace 1 & 2. And a mixed mode dataset that in 1 that references a dataset in 2. Then using the same service princial account I "executeQueries" against the import dataset in both workspaces - but then get the PowerBINotAuthorizedException when I try to execute against the mixed mode dataset. 

 

So the principal account is setup and configued correctly for both workspaces. This feels more like a bug than a missing feature. 

 

Anonymous
Not applicable

Through ADF WEB activity im trying to run one dax query which gives me single data value. Same i tried for both mixed and only import still im facing PowerBiUnathorized error. But when connecting usage metrics dataset of the workspace, it is connecting. How Weird it is, usage metrics dataset of the workspace it is connecting but the dataset in the workspace where service prinicpal is the admin(owner) of the workspace still facing the error. (PowerBIUnAuthorizedError)