ADF Pipeline-Loop starts over again when the inner activity fails

Ramamoorthy, Kesavan 61 Reputation points
2021-03-10T08:44:36.953+00:00

Hi Experts,

The picture below shows the activities inside Loop in my ADF pipeline wherein we have a copy activity that fetches data from an api using http connector.

76187-image.png

Whenever the copy activity fails due to some reason in the api, the loop goes back and starts from the 1st step. For example, when loop starts with the first iteration and when copy activity fails, it goes back to the first step i.e. "Get Access Token2" and start running from there. Is this a normal behavior? Sorry I am fairly new to Azure.

Is there any way that we stop the loop as soon as the copy activity fails.? Basically it should not go back to the first step of the loop when the copy activity fails.

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,624 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Vaibhav Chaudhari 38,916 Reputation points Volunteer Moderator
    2021-03-10T09:38:57.437+00:00

    Yes, this is expected behavior. Loop starts and if some activity within loop fails it iterates for next loop and run all inner activities again.

    You will have to customize the solution with some flag logic to break the loop.

    Refer below blog for the logic -
    https://andyleonard.blog/2020/06/one-way-to-break-out-of-an-azure-data-factory-foreach-activity/

    You can also upvote existing feedback here -
    https://feedback.azure.com/forums/270578-data-factory/suggestions/39673909-foreach-activity-allow-break


    Please don't forget to Accept Answer and Up-vote if the response helped -- Vaibhav

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.