Reputation: 149
I've been trying to get Data Factory Deployments working through VSTS and am mostly there, but I'm getting a failure due to the triggers needing to be disabled to be overwritten. Error message below:
Remove-AzureRmDataFactoryV2Trigger : HTTP Status Code: BadRequest
Error Code: TriggerEnabledCannotUpdate
Error Message: Cannot update enabled Trigger; it needs to be disabled first.
Request Id: <id number here>
Timestamp (Utc):06/17/2018 21:31:49
At line:1 char:1
+ Remove-AzureRmDataFactoryV2Trigger -ResourceGroupName "ResourceGroupName" -Data ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Remove-AzureRmDataFactoryV2Trigger], ErrorResponseException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.DataFactoryV2.RemoveAzureDataFactoryTriggerCommand
I get this error when both trying to do a straight deployment, but also when manually running a powershell script to remove the trigger
Remove-AzureRmDataFactoryV2Trigger -ResourceGroupName "ResourceGroupName" -DataFactoryName "DataFactoryName" -Name "TriggerName"
I cant find a way to disable a trigger via powershell or during a release. Can anyone help me find a way around this? Without it I cant do Continuous integration releases with the Data Factory.
Thanks
Upvotes: 6
Views: 11214
Reputation: 2363
Call Stop-AzureRmDataFactoryV2Trigger before removing it.
Iterate round all defined triggers and set to variable
$triggersADF = Get-AzureRmDataFactoryV2Trigger -DataFactoryName <DataFactoryName> -ResourceGroupName <ResourceGroupName>
Disable all triggers
$triggersADF | ForEach-Object { Stop-AzureRmDataFactoryV2Trigger -ResourceGroupName <ResourceGroupName> -DataFactoryName <DataFactoryName> -Name $_.name -Force }
re-enable triggers post deployment
$triggersADF | ForEach-Object { Start-AzureRmDataFactoryV2Trigger -ResourceGroupName <ResourceGroupName> -DataFactoryName <DataFactoryName> -Name $_.name -Force }
Upvotes: 11