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":
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.
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!
Thank you this setting worked perfectly !!!
The only thing I changed on the flow which failed for me was to set the Run only users settings:
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.
Did you check the flow's settings for the related connection reference as I described above?
Hi, I am having the same issue, Could you please explain in detail how you fixed it? Thank you
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...