Hello Reyshma Sekar,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
I understand that you would like to stop/start triggers in ADF environments using CI/CD release pipeline in Azure Data Factory.
Instead of generic troubleshooting for common issues, since Stop-AzDataFactoryV2Trigger
returns True
but does not actually stop the triggers, the root cause was limited to these four areas:
- Triggers Are in a Queued or Inactive State
- Some triggers are linked to pipelines that need explicit stopping.
- If using an older version, this could be a known issue.
- If an ARM policy enforces a specific trigger state, it may automatically restart or prevent the stop command from taking effect.
Therefore, my best practice advice to resolve your issue are the followings:
- Use the Azure REST API to Stop Triggers:
$accessToken = (Get-AzAccessToken -ResourceUrl "https://management.azure.com").Token $resourceGroupName = "<Your_ResourceGroup>" $dataFactoryName = "<Your_DataFactory>" $triggers = Get-AzDataFactoryV2Trigger -ResourceGroupName $resourceGroupName -DataFactoryName $dataFactoryName foreach ($trigger in $triggers) { $triggerName = $trigger.TriggerName $url = "https://management.azure.com/subscriptions/<your_subscription_id>/resourceGroups/$resourceGroupName/providers/Microsoft.DataFactory/factories/$dataFactoryName/triggers/$triggerName/stop?api-version=2018-06-01" Invoke-RestMethod -Uri $url -Method Post -Headers @{Authorization="Bearer $accessToken"} -ContentType "application/json" Write-Output "Stopping trigger: $triggerName" }
- Verify Trigger State:
Get-AzDataFactoryV2Trigger -ResourceGroupName $resourceGroupName -DataFactoryName $dataFactoryName | ForEach-Object { $_.Properties.RuntimeState }
- Check for Auto-Restart Policies:
- In the Azure Portal, check the trigger settings for any auto-restart policies.
- Ensure that triggers are not linked to pipelines with Start on Completion dependencies.
- Update Azure PowerShell Module:
Update-Module -Name Az -Force (Get-Module -Name Az).Version
This will resolve the issue.
I hope this is helpful! Do not hesitate to let me know if you have any other questions.
Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.