How to Setup a Trigger in Azure Data Factory that runs daily every 2 hours from 6 AM to 10 PM

Parsa Bahrami 20 Reputation points
2023-06-05T23:47:07.5033333+00:00

Hello Everyone!

How to Setup a Trigger in Azure Data Factory that runs daily every 2 hours from 6 AM to 10 PM?

Thanks.

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

Accepted answer
  1. ShaikMaheer-MSFT 38,546 Reputation points Microsoft Employee Moderator
    2023-06-07T09:08:30.31+00:00

    Hi Parsa Bahrami,

    Thank you for posting query in Microsoft Q&A Platform.

    If I understand correctly, you mean to say trigger should run pipeline every 2 hours daily. But it should run pipeline only between 6AM to 10PM windows. After 10PM till next 6AM it should not run pipeline. Please correct me if my understanding is wrong.

    There is no direct way of doing this within trigger. You need to handle this in your Pipeline. Follow below steps to achieve same.

    Step1: Create a trigger which start time is 6AM and setup reoccurrence for every 2 hours. This will run your pipeline every day for every 2 hours.

    Step2: Since we dont want to run pipeline from 10PM to 6AM. Inside, your pipeline have a if activity to check the trigger time. If trigger time or pipeline run time is >= 10PM OR <= 6AM. then for that executions don't run your logic. For all other windows run your logic by keeping activities inside else or if blocks.

    This way technically, when if your trigger running pipeline, it will technically valid the run time and then exclude or include activities to run.

    Please note, pipeline run time or trigger time you can get from system variables or from trigger variables. Check below videos to know more about them.

    System Variables in Azure Data Factory

    Schedule Trigger in Azure Data Factory

    Hope this helps. Please let me know if any further queries.


    Please consider hitting Accept Answer button. Accepted answers help community as well.

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

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.