APPLIES TO:
Azure Data Factory
Azure Synapse Analytics
Tip
Try out Data Factory in Microsoft Fabric, an all-in-one analytics solution for enterprises. Microsoft Fabric covers everything from data movement to data science, real-time analytics, business intelligence, and reporting. Learn how to start a new trial for free!
The following sample demonstrates how to use a pre- and post-deployment script with continuous integration and delivery in Azure Data Factory.
Make sure to use PowerShell Core in ADO task to run the script
Pre- and post-deployment script
The sample scripts to stop/ start triggers and update global parameters during release process (CICD) are located in the Azure Data Factory Official GitHub page.
Note
Use the PrePostDeploymentScript.Ver2.ps1 if you would like to turn off/ on only the triggers that have been modified instead of turning all triggers off/ on during CI/CD.
Script execution and parameters
The following sample script can be used to stop triggers before deployment and restart them afterward. The script also includes code to delete resources that have been removed. Save the script in an Azure DevOps git repository and reference it via an Azure PowerShell task the latest Azure PowerShell version.
When running a predeployment script, you need to specify a variation of the following parameters in the Script Arguments field.
The -deleteDeployment flag is used to specify the deletion of the ADF deployment entry from the deployment history in ARM.
Script execution and parameters - YAML Pipelines
The following YAML code executes a script that can be used to stop triggers before deployment and restart them afterward. The script also includes code to delete resources that have been removed. If you're following the steps outlined in New CI/CD Flow, this script is exported as part of artifact created via the npm publish package.