简体   繁体   中英

Monitoring long running Power Automate Cloud Flow from Azure Function App

I need to be able to execute a long running Power Automate Cloud Flow (say 2 hours) from Azure Function App(using Visual Studio for development).

My set up:

  1. I have Azure Function App With Durable Function that executes System.Net.Http.HttpClient.PostAsync
  2. I have a Power Automate Cloud Flow which is triggered by a HTTP call and has a 2 minute delay inside

Issue: Naturally it times out.

What I tried: I tried overriding System.Net.Http.HttpClient.SendAsync and timeout policies to make the timeout indefinite, but that doesn't work, not that it would work given 2hr run times.

My best case scenario: What I really want is an ability to send a request to start execution of the Power Automate Cloud Flow kind of like a job, and then have ability to monitor execution by going some kind of monitoring place. I am pretty positive that's what power automate does internally, but how would I do it from Azure Function App? For the life of me I cannot find an answer to this:)

So I figured it out, figured I should post the answer. I forgot that when you want to use asynchronous pattern you have to enable Async Response in your flow. So any response in the flow should be set to Async in the settings.

This action will enable Asynchronous pattern for the flow, and HTTP calling it, will reply right away with status 202, and info about the URL to go for checking the status in the headers.

So it was much simpler than one would imagine:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM