how to keep adf triggers on different days in dev prod environment?

Akshay Dhabale 0 Reputation points
2023-02-22T15:45:38.8933333+00:00

I need help regarding having triggers scheduled on different days in Dev and Prod Environment of ADF.

We are currently using CI/CD for this process Manually updating triggers in Prod after deployment.

Thanks,

Akshay

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

1 answer

Sort by: Most helpful
  1. Nandan Hegde 36,716 Reputation points MVP Volunteer Moderator
    2023-02-22T16:18:16.6766667+00:00

    You can use Azure Devops Powershell task :

    $ResourceGroupName= "$(ResourceGroup)"
    $DataFactoryName= "$(factoryName)"
    
    $TriggerCode = 
    '{
        "name": "<<>TRName>",
        "properties": {
            "description": ".",
            "annotations": [],
            "runtimeState": "Started",
            "pipelines": [
                {
                    "pipelineReference": {
                        "referenceName": "<<>>",
                        "type": "PipelineReference"
                    }
                }
            ],
            "type": "ScheduleTrigger",
            "typeProperties": {
                "recurrence": {
                    "frequency": "Week",
                    "interval": 1,
                    "startTime": "2022-05-02T10:26:00Z",
                    "timeZone": "UTC",
                    "schedule": {
                        "minutes": [
                            30
                        ],
                        "hours": [
                            20
                        ],
                        "weekDays": [
                            "Thursday"
                        ]
                    }
                }
            }
        }
    }'
     
    $TriggerName = "<<TRName>>" 
    
    
     
    Stop-AzDataFactoryV2Trigger -ResourceGroupName $ResourceGroupName -DataFactoryName $DataFactoryName -name $TriggerName -Force 
    
    Set-AzDataFactoryV2Trigger -ResourceGroupName $ResourceGroupName -DataFactoryName $DataFactoryName -name $TriggerName -DefinitionFile $TriggerPath -Force 
    
    Start-AzDataFactoryV2Trigger -ResourceGroupName $ResourceGroupName -DataFactoryName $DataFactoryName -name $TriggerName -Force
    
    

    And based on the Env, you can make the necessary adjustments

    User's image

    0 comments No comments

Your answer

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