Gav Cheal
Gav Cheal

Reputation: 37

Can you set a triggers state within an ADF pipeline?

This is a dilemma that can be solved manually but I don't really thing that that is a good solution, I want to sleep.

I have a pipeline that is fired off by a trigger every hour, to migrate data, it has two states DAILY and HOURLY. This works fine... mostly. But in some circumstances it has failed. It was in the initial loading of the data which was a 2 year loop.

I have had to create a fix to fill in the missing days, so that part is OK too. But now I want to be able to create this into a pipeline, so the order of events is.

  1. Turn off pipeline to run the fix.
  2. Run the fix.
  3. Run the clean up.
  4. Run the main pipeline in DAILY mode.
  5. Turn on the trigger for the pipeline to run every hour.

What I was hoping to do is manually turn off the pipeline, and set the FIX pipeline to run in its place. Once the pipeline has completed, I then want to switch the pipeline back on again, which could be the last activity in the fix pipeline.

So that is the scenario, however I cannot find an activity that can change the state of a trigger. Is this possible? Can it be done with a power script? If so how, would that work?

Many thanks

Upvotes: 0

Views: 544

Answers (1)

AnnuKumari
AnnuKumari

Reputation: 563

Yes you can start and stop trigger using powershell using the following command:

Start-AzDataFactoryV2Trigger
 [-Name] <String>
 [-ResourceGroupName] <String>
 [-DataFactoryName] <String>
 [-Force]
 [-DefaultProfile <IAzureContextContainer>]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

and

Stop-AzDataFactoryV2Trigger
[-Name] <String>
[-ResourceGroupName] <String>
[-DataFactoryName] <String>
[-Force]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]

Documentation:

Start ADF trigger

Stop-AzDataFactoryV2Trigger

Upvotes: 0

Related Questions