Azure Data Factory: How to stop/start triggers in ADF environments using CI/CD release pipeline?

Reyshma Sekar 20 Reputation points
2025-01-30T13:27:11.65+00:00

We would like to stop all triggers in our dev ADF environment after deploying to production. I've seen the below script being used:

  • task: AzurePowerShell@4 displayName: 'Data Factory: Stop all triggers'

inputs: azureSubscription: '${{ parameters.connection }}'

ScriptType: InlineScript

Inline: | $triggers = Get-AzDataFactoryV2Trigger -ResourceGroupName ${{ parameters.resourcegroupName }} -DataFactoryName ${{ parameters.dataFactoryName }} -ErrorAction SilentlyContinue

if($triggers)

{ for each($trigger in $triggers)

{ Stop-AzDataFactoryV2Trigger -ResourceGroupName ${{ parameters.resourcegroupName }} -DataFactoryName ${{ parameters.dataFactoryName }} -Name $trigger. TriggerName -Force } }

azurePowerShellVersion: latest version

When I break it down and run Get-AzDataFactoryV2Trigger, it returns all the triggers in my data factory but when running Stop-AzDataFactoryV2Trigger, it returns true but when checking in ADF, the trigger is not stopped. I tried to run these commands in the release pipeline using Azure Powershell and, in the portal, using Azure CLI. confirmed the right subscription is being used.

Confirmed that the DataFactory Contributor role is set for the dev resource group and other permissions are set up for the subscription and resource group.

What else can I try? Has anyone had this issue before?

Azure Data Factory
Azure Data Factory

An Azure service for ingesting, preparing, and transforming data at scale.


1 answer

Sort by: Oldest
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    2 deleted comments

    Comments have been turned off. Learn more

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.