Skip to main content

Notifications

Community site session details

Community site session details

Session Id : UxSmp0ai1SsQvAhz5ljflP
Power Automate - Using Connectors
Answered

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

Like (1) ShareShare
ReportReport
Posted on 25 Aug 2023 09:45:50 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!

 

  • pgoll Profile Picture
    3 on 10 Jun 2024 at 18:34:20
    Re: Run query against dataset - Unauthorized when used in a solution?

    Thank you this setting worked perfectly !!!

  • Maltener Profile Picture
    74 on 21 Sep 2023 at 13:54:51
    Re: Run query against dataset - Unauthorized when used in a solution?

    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. 

  • subbu97 Profile Picture
    4 on 21 Sep 2023 at 13:49:04
    Re: Run query against dataset - Unauthorized when used in a solution?
    my email Id is selected in other connections.
  • Maltener Profile Picture
    74 on 21 Sep 2023 at 13:34:24
    Re: Run query against dataset - Unauthorized when used in a solution?

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

  • subbu97 Profile Picture
    4 on 21 Sep 2023 at 13:15:38
    Re: Run query against dataset - Unauthorized when used in a solution?

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

  • Verified answer
    Maltener Profile Picture
    74 on 25 Aug 2023 at 13:22:42
    Re: Run query against dataset - Unauthorized when used in a solution?

    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...

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Using Connectors

#1
lbendlin Profile Picture

lbendlin 7 Super User 2025 Season 1

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 6 Super User 2025 Season 1

#3
KT-07051015-0 Profile Picture

KT-07051015-0 4

Overall leaderboard

Featured topics