Rodney Koolman
Rodney Koolman

Reputation: 33

Azure Logic App: HTTP POST in For Each loop shows unauthorized error

We have a problem with our logic app if we process multiple files in a For Each loop and try to do a HTTP POST to a Third-Party. Each file can have different urls/usernames/passwords for the HTTP POST step. This is why set username/password/url variables in our For Each.

Tests:

Our conclusion:

If the http post gets dynamic variables (username/password/url) in a for each step some only some http post work. But for files with other login data, it fails. Looks like the HTTP connector cannot handle dynamic multiple http calls with different variables.

Our http post step: enter image description here

Our if true condition inside a for each step (unautorized error while all login and url variables are correct):

enter image description here

Are we doing something wrong? Please help as we are trying to move this to production.

Upvotes: 0

Views: 1317

Answers (1)

Mike Urnun MSFT
Mike Urnun MSFT

Reputation: 478

For Each loop in Logic Apps runs its iterations in parallel by default -- so if you've designed your workflow such that correct pair of username and password for their corresponding HTTP POST are determined at runtime in each iteration, based on original order of collection the loop began -- it'll probably produce the behavior you're observing. Assuming that was the case, have you tried running the loop with Sequential option on?

https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-control-flow-loops#sequential-foreach-loop

Upvotes: 3

Related Questions