I've been working quite a bit lately with Azure Data Factory (V2) and Ive been deploying them using ARm Templates. Well technically, I'm using terraform. But terraform doesn't support ADF and so it's a case of using terraform to deploy an ARm Template. Anyway, I digress… I've included the triggers in the ARM Template to be deployed, yet after the first deployment of the triggers i got this error below -
Cannot update enabled Trigger; it needs to be disabled first.
Alright it seems there's a pretty obvious way around this: disable them prior to deploying the ARM Template, and enabling them afterwards. This is a pretty straightforward change if all your triggers are enabled. And so the script to disable is below.
…And this here is the one to enable…
Where this gets slightly more tricky is if not all need to be enabled. In that case adding a array of trigger names and in the foreach loop checking if it is included in the array.