Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Function App Programmatically Change Schedule

I have a number of function apps that run based on "Timer Triggers"

At the moment they are running every 5 minutes.

public static async Task Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer, TraceWriter log)

I want to be able to read the current timer setting and change the TimerTrigger value programmatically so that we can change it from a management portal.

Is this possible?

like image 389
Trevor Daniel Avatar asked Jan 03 '23 11:01

Trevor Daniel


1 Answers

There is no way to this today when using the VS precompiled model. But it is interesting feedback, and I suggest opening an issue on https://github.com/Azure/azure-functions/issues.

Update: it's actually possible to achieve this using an App Setting to hold the cron. Stealing example from https://github.com/Azure/azure-webjobs-sdk-script/issues/1934:

public static void Run([TimerTrigger("%CRON_EXPRESSION%")]TimerInfo myTimer, TraceWriter log)
like image 80
David Ebbo Avatar answered Jan 13 '23 09:01

David Ebbo