web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Run query against data...
Power Automate
Answered

Run query against dataset - Unauthorized when used in a solution?

(1) ShareShare
ReportReport
Posted on by 74

Hello! I'm working on a new version of an app which is already used in its current version by thousands of employees in our company.

The app uses a power automate flow which contains a "Run query against a dataset" action. The queried dataset is in a premium capacity, I am admin of that capacity and have all permissions in PowerBI to edit the dataset. All users can use the app without issues. They pull data from the PowerBI dataset via the connector I use in the Power Automate Flow, which is triggered by the PowerApp.

 

Now, as mentioned, my target is to update the app and improve its structure and functionality. I was wrapping everything in a solution in PowerAutomate. The solution now contains a few flows and the PowerApp.

The first flow which is retrieving the data from the PowerBI dataset is doing exactly the same as it does for the current app, which is not part of a solution.

It works for me, but as soon as other users try to use it, the connector fails and returns an "Unauthorized" response. The users have access to the PowerBI dataset though and the old app still works fine. No issues with the queries against the dataset there. Does anyone have an idea what's going on?

 

This is the error which is thrown by the "run query against dataset" connector:

 

 

 

 

 

 

{
 "statusCode": 401,
 "headers": {
 "X-PowerBI-Error-Info": "GroupNotAccessible",
 "Strict-Transport-Security": "max-age=31536000; includeSubDomains",
 "X-Frame-Options": "deny",
 "X-Content-Type-Options": "nosniff",
 "Access-Control-Expose-Headers": "RequestId,X-PowerBI-Error-Info",
 "RequestId": "xxxxxxxxxxxxxxxxxxxxxxxxxx",
 "Timing-Allow-Origin": "*",
 "x-ms-apihub-cached-response": "true",
 "x-ms-apihub-obo": "false",
 "Date": "Fri, 25 Aug 2023 09:26:38 GMT",
 "Content-Length": "236",
 "Content-Type": "application/json"
 },
 "body": {
 "error": {
 "code": 401,
 "source": "xxxxxxxxxxxxxxxxxxxxxxxxx",
 "clientRequestId": "xxxxxxxxxxxxxxxxxxx",
 "message": "The response is not in a JSON format.",
 "innerError": "Cannot read server response."
 }
 }
}

 

 

 

 

 

 

 

The header of the connector shows "Unauthorized":

Maltener_0-1692964545048.png

 

 

Edit:
Just did some more troubleshooting and found out something interesting:

There are two ways of adding flows to a PowerApp I can think of.

  1. Creating and adding a flow from within the app like this:
    Maltener_0-1692968507457.png

     

  2. I create a flow the classic way like this:
    Maltener_1-1692967515003.png
    This requires to add the flow manually to the solution in order to make it available and add it in the PowerApp:
    Maltener_2-1692967671094.png

     

When I use the first way, other users cannot run the flow from within the because the PowerBI connector returns the Unauthorized error. 
When I use the second way, it works. I just don't understand why. Any help would be much appreciated!

 

Categories:
I have the same question (0)
  • Verified answer
    Maltener Profile Picture
    74 on at

    Just for the record after spending hours on trouble shooting: It was me missing a quite important setting of the PowerBI connection reference in the flow.
    The run only users settings was the issue. Set it to user my own connection reference and everything worked...

  • subbu97 Profile Picture
    4 on at

    Hi, I am having the same issue, Could you please explain in detail how you fixed it? Thank you

  • Maltener Profile Picture
    74 on at

    Did you check the flow's settings for the related connection reference as I described above?

  • subbu97 Profile Picture
    4 on at
    my email Id is selected in other connections.
  • Maltener Profile Picture
    74 on at

    The only thing I changed on the flow which failed for me was to set the Run only users settings:

    Maltener_0-1695304403399.png


    My PowerBI connection reference used "Provided by run-only user" which was failing as the user didn't have access to the dataset. After selecting "Use this connection instead (my account)" it worked fine, I didn't get any Unauthorized errors anymore. 

  • pgoll Profile Picture
    3 on at

    Thank you this setting worked perfectly !!!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard