Skip to main content

Notifications

Power Automate - Using Connectors
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!

 

  • pgoll Profile Picture
    pgoll 3 on at
    Re: Run query against dataset - Unauthorized when used in a solution?

    Thank you this setting worked perfectly !!!

  • Maltener Profile Picture
    Maltener 74 on at
    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
    subbu97 4 on at
    Re: Run query against dataset - Unauthorized when used in a solution?
    my email Id is selected in other connections.
  • Maltener Profile Picture
    Maltener 74 on at
    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
    subbu97 4 on at
    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
    Maltener 74 on at
    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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,691

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 65,019

Leaderboard

Featured topics