cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
thunderstorm654
Regular Visitor

Power Apps triggered Flow - 401 unauthorized using CDS actions (Get record, get file content etc) but with other types of trigger they work fine

Hi,

 

I'm having some trouble using the Common Data Service actions.

 

I need a Flow that is triggered via a Power Apps button, within the Flow I'm then using 'Get record' to grab a specific record inside a CDS entity, then also I am retrieving the contents of a file field, combining the returned info to send in an email.

 

This was all working fine on Tuesday but this morning I'm now seeing 401 unauthorized on all CDS actions.

 

I did some digging and if I created a manually triggered Flow (e.g. via Flow button) then the CDS actions are working fine and I get the data back, same user account etc.

 

I definitely have access to the CDS still so it seems something funny is going on when the trigger is Power Apps - even when I test this Power App triggered Flow manually via the Flow tester I get the same error. Any ideas? A bit confused and wondering if there's just a bug right now or something I'm missing, since these actions work with different triggers.

 

Many thanks!

10 REPLIES 10
Pstork1
Dual Super User III
Dual Super User III

If you've made any changes to the flow recently that is probably the problem.  When you do a regularly triggered flow it checks the authentication of the flow connectors when you start the flow.  But when you launch a flow from a Power App it authenticates the connectors when you first launch the Power App.  The problem is that if you later change the flow parameters or connectors then Power Apps doesn't know to re-request authentication.  Try removing the Flow, save and publish, and then re-add it into the Power App.  You should get an oauth request when you launch the Power App that includes the connectors for the flow.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
CharlieHowURun
New Member

Have the same problem. Passing string value through PowerApps trigger and then calling a CDS action (List in this case) and it's erroring with Unauthorized. Did some hacking around and if you turn Concurrency Control setting on for PowerApps trigger and then set the List action to Async it will work in test and return a value through Response to PowerApps action. What's broken now for me, however, is the Response action that I was using to return a JSON array now no longer returns (even though when I test it, I can see that it gets the data).

I'm now getting this issue as well with a flow triggered by a button in a canvas app, which is embedded into a model driven form. 

 

I've tried @Pstork1 's suggestion of removing the flow from the app, saving and publishing it and then adding the flow back, but I still get the same issue - the Get record CDS current environment action is given the correct record id by the Power Apps trigger but it can't get the actual record.

 

The error message text is:

{"statusCode":401,"headers":{"x-ms-service-request-id":"d0100d2e-337a-4225-8476-48f447166de6,8ecb33b3-5905-4415-93c8-6c3cd6013a18","Set-Cookie":"ARRAffinity=419ae23f118f21674ab1e97561491a01f2c13ead6792ebae5fbc1431abcd355f; domain=org4cadf9a9.crm11.dynamics.com; path=/; secure; HttpOnly,ReqClientId=ea2c972c-af30-465f-ba98-50de5b9bb60f; expires=Sun, 27-Jul-2070 11:34:37 GMT; path=/; secure; HttpOnly; samesite=none,ARRAffinity=419ae23f118f21674ab1e97561491a01f2c13ead6792ebae5fbc1431abcd355f; domain=org4cadf9a9.crm11.dynamics.com; path=/; secure; HttpOnly","WWW-Authenticate":"Bearer authorization_uri=https://login.microsoftonline.com/2c78a6be-d47e-440e-9089-1d77de02c7c2/oauth2/authorize, resource_id=https://org4cadf9a9.crm11.dynamics.com/","Strict-Transport-Security":"max-age=31536000; includeSubDomains","REQ_ID":"8ecb33b3-5905-4415-93c8-6c3cd6013a18","AuthActivityId":"76b2a12f-2d26-48fe-9362-09df0937f028","NativeWebSession-Version":"2","X-Source":"802161491481472041374347217250612432378542127206017227119854747119910416216320112,2042147619211523911641832317369521882138020201162141918423210015523318563194167239138","Public":"OPTIONS,GET,HEAD,POST","Timing-Allow-Origin":"*","Date":"Mon, 27 Jul 2020 11:34:36 GMT","Content-Length":"0","Allow":"OPTIONS,GET,HEAD,POST"}}

And here is the flow:

Capture.JPG

Has anyone got any ideas?

 

Thanks!

 

Simon

 

JarnoLucaAUG
Frequent Visitor

Same issue over here.

I have created a power app to enrol tenants. When the tenant status changes, the person responsible should be notified through email and an event in their outlook agenda.
When clicking the button, a flow is triggered which uses Common Data Service (current environment). Worked fine until 4 weeks ago, when suddenly the Flow stopped working with the Unauthorised CDS error.

 

Hi @JarnoLucaAUG 

 

I've posted my issue on a separate post https://powerusers.microsoft.com/t5/Building-Flows/Button-triggered-flow-Get-Record-action-failing-a... along with some extra points I discovered - but no fix yet.

 

Yesterday I raised a support ticket so I'll update you if/when I hear back from them!

 

Simon

Hi @sdowse 

 

I raised the issue with MS support in the end, and they told me it was because I had my app and Power Apps triggered Flow inside of a solution. It seems the CDS actions weren't working properly inside the solution, not giving the option to select an environment. Although they default to 'current' this wasn't working. Support basically confirmed there are some bugs with Power Apps triggered Flows inside solutions right now and to create them outside.

 

However this didn't work for me either, as half the CDS actions disappeared (I'm also needing get file or image content). This seemed to keep changing over the last week or so, sometimes they are there, and sometimes not, in and out of solutions. Our use case was to retrieve a document from a file field in a CDS entity. As we had to get our app over to a client we ended up switching to storing the documents in a SharePoint library, and tagging them with the name of our records to be able to query them via Flow. This is working but it is a rubbish workaround as means we have to tell users to upload files elsewhere and manually tag. This isn't going to help for other requirements though, it was lucky there was an alternative in this case.

 

It just seems the CDS actions are too buggy right now, and we couldn't run the risk of it working again one day and then breaking the next. In our environment now we can see the 'environment' drop down on the CDS actions again but after reworking once already I'd like to see a bit more evidence it is definitely working before switching back!

 

It's a shame though and quite frustrating when things work one day and randomly break a day or two later.

Hi @thunderstorm654 

 

Thanks for the update - that's really useful.

 

So I think the "normal" CDS actions are working (they are the ones that let you choose the environment - but of course when you export your solution to a different environment (i.e. test or production) you then have to update every single action to point to the new environment 🙄) but it is the "CDS (current environment)" actions which are broken - you can only use (and access) these actions from within a solution, so it is not helpful that MS support are telling you that the problem is that you are using them inside a solution! These are the ones that don't let you choose an environment, as they are just meant to use the environment they find themselves in.

 

Like you, I need some of the extra actions available with the CDS (current environment) (and I'd rather not spend hours updating loads of actions when I export my solution, as mentioned above), so it is a bit of a pain!

 

Thanks again!

 

Simon

 

@thunderstorm654 @JarnoLucaAUG @CharlieHowURun 

 

Apparently MS are working on it....

 

Capture.JPG

Awesome! Glad to hear that Microsoft knows of this issue.

 

Also thanks for keeping us in the loop and creating the ticket! I was planning on doing the same.

 

I've also posted some little tests and their results on your separate thread. I'm planning some more expanded tests next week. 

 

By the way, for a potential workaround, do you need a response from the Flow to your Power App?

I've considered changing the logic of my Flow to use the "when a record is created trigger" because my Power app doesn't need feedback. 

Though, it would also need the current environment connector, because I need to export the solution to the Company environment for testing. Which means this could potentially cause some errors as well.
I'm planning on trying the "when a record is created trigger" next week, then I'll post the results of that as well. 

 

This worked for me and was very easy to get working for me.

I had made an update to a part of the flow which then broke due to unauthorised, following this process got it working again.

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Users online (21,461)