How to abort iteration if something fails in ADF

Mutthuluru Yashwanth Sai 0 Reputation points
2024-07-04T12:12:51.8133333+00:00

Hi Team,

I am running a process using a foreach activity, designed such that if the first iteration fails, it should abort and not proceed to the second iteration. However, this is not working as expected in my case. Could someone please assist me?

Please refer to the screenshot below.

User's image

In the screenshot, the first iteration failed. I added a fail activity to abort the process, but it still proceeded to the second iteration.

How can I resolve this issue?

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

2 answers

Sort by: Most helpful
  1. Nandan Hegde 31,511 Reputation points MVP
    2024-07-04T12:18:16.6866667+00:00

    In case of ADF, the For each activity would complete all iterations irrespective of failure in intermediate iteration.

    There are 2 ways how you can abort :

    1. use web activity to cancel the pipeline run in case if you want to abort post failure in any iteration
    2. Have a log table wherein you flag whether the iteration is a success/failure. At the start of foreach, have a lookup activity to chcek whether the prev iteration is success, then proceed else skip

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more