ADF Pipeline trigger deployment on DevOps

David 21 Reputation points
2021-05-24T04:03:44.96+00:00

I'm doing some initial ADF deployment from my adf-dev to adf-staging environment. In the MS docs it says:

Deployment can fail if you try to update active triggers. To update active triggers, you need to manually stop them and then restart them after the deployment.

Does this mean I need to turn off my dev or staging triggers pre/post deployment?

2nd issue. I need to schedule the same set of triggers to run on different days in dev (sat) vs staging (sun). Do I need to make a separate set of triggers for each environment then or can I rewrite the trigger schedules for the existing triggers during deployment?

Sample Trigger:

    		{  
    			"name": "[concat(parameters('factoryName'), '/Parts_Central_Cube_Data_Tables')]",  
    			"type": "Microsoft.DataFactory/factories/triggers",  
    			"apiVersion": "2018-06-01",  
    			"properties": {  
    				"annotations": [],  
    				"runtimeState": "Started",  
    				"pipelines": [  
    					{  
    						"pipelineReference": {  
    							"referenceName": "DARTT_Master_Parallel",  
    							"type": "PipelineReference"  
    						},  
    						"parameters": {  
    							"PipelineScheduleName": "[parameters('Parts_Central_Cube_Data_Tables_properties_DARTT_Master_Parallel_parameters_PipelineScheduleName')]",  
    							"TestMode": "[parameters('Parts_Central_Cube_Data_Tables_properties_DARTT_Master_Parallel_parameters_TestMode')]",  
    							"DtuScaleOn": "[parameters('Parts_Central_Cube_Data_Tables_properties_DARTT_Master_Parallel_parameters_DtuScaleOn')]"  
    						}  
    					}  
    				],  
    				"type": "ScheduleTrigger",  
    				"typeProperties": {  
    					"recurrence": {  
    						"frequency": "Week",  
    						"interval": 1,  
    						"startTime": "2021-04-23T13:35:00",  
    						"timeZone": "Eastern Standard Time",  
    						"schedule": {  
    							"minutes": [  
    								0  
    							],  
    							"hours": [  
    								22  
    							],  
    							"weekDays": [  
    								"Sunday"  
    							]  
    						}  
    					}  
    				}  
    			},  
    			"dependsOn": [  
    				"[variables('factoryId')]",  
    				"[concat(variables('factoryId'), '/pipelines/DARTT_Master_Parallel')]"  
    			]  
    		},  
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,148 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Nandan Hegde 29,551 Reputation points MVP
    2021-05-24T14:05:47.883+00:00

    Hey,
    In case of our scenario; we have 4 environments.
    Below is the process which we follow for automated deployment via Azure devops

    1. have a powershell script that disables all the active triggers in ADF
    2. deploy the ADF arm template ( have a common arm template for all environments)
    3. have a powershell script that updates the trigger timing based on environment (either disable in lower environments to save cost or have different timings across uat and prod env)
    1 person found this answer helpful.

  2. MartinJaffer-MSFT 25,996 Reputation points
    2021-06-02T22:04:45.447+00:00

    Hello @David and welcome to Microsoft Q&A.

    If you would like to make trigger settings differ on deployment environment, you can set the custom parameters using the resource manager template. This will affect all the triggers. In the document it has example, (excerpt):

    "Microsoft.DataFactory/factories/triggers": {  
            "properties": {  
                "typeProperties": {  
                    "recurrence": {  
                        "*": "=",  
                        "interval": "=:triggerSuffix:int",  
                        "frequency": "=:-freq"  
                    },  
                    "maxConcurrency": "="  
                }  
            }  
    

    On the pieces you want to change, replace = with -.

    This affects all triggers, not just a specific one.