We are writing rest API to make updates to the azure data factory triggers but we get below error :
Resolved [com.azure.core.management.exception.ManagementException: Status code 400, "{"error":{"code":"TriggerEnabledCannotUpdate","message":"Cannot update enabled Trigger; the trigger needs to be disabled first. ","target":null,"details":null}}": Cannot update enabled Trigger; the trigger needs to be disabled first. ]
but when we try to do the same from portal, it runs without any issue. Simply, if we go and edit an trigger which is already in started state, its gets edited without any issues.
so why this difference in behaviour when it is done manually vrs through rest api?
so why this difference in behaviour when it is done manually vrs through rest api?
It is the behavior of ADF for the sake of preventing the unexpected changes when trigger is running.
When you edit the trigger from ADF portal, the ADF itself disables the trigger upon publishing the changes and re-enables it. This is the design of ADF in the portal for the simplicity.
You can even change that setting of to start or stop the trigger in the trigger edit.
But when you make updates from external calls like REST API or PowerShell, it is the prior step to disable the trigger first as it makes the sequence of steps easier and gives control over those steps. Hence, you need to first Stop the trigger -> Make changes -> Start trigger when you use external calls to update the trigger.