I have an Azure Function (built in Visual Studio 2019, and running on the .NET Core 3.x stack in Azure) that is supposed to be triggered by a timer to run e.g. once per night.
I can easily create the function and define the schedule as an NCRONTAB expression like this:
[FunctionName("MyFunctionName")]
public void Run([TimerTrigger("0 15 3 * * 1-5")]TimerInfo myTimer, ILogger log)
{
// Azure function code here ....
}
Works like a charm - BUT I'd like to be able to define the schedule in the Azure Portal - not in my function code - to handle e.g. DEV vs. TEST vs. PROD situations. On the DEV and TEST platforms, I might want to run this several times a day - in production maybe only once a week.
But with this approach, once the schedule is set - it's set, I cannot change it in the Azure Portal (all the input fields are grayed out / editing is disabled).
I was hoping I might be able to just skip the NCRONTAB expression in the declaration of my Azure function - like so:
[FunctionName("MyFunctionName")]
public void Run([TimerTrigger()]TimerInfo myTimer, ILogger log)
{
// Azure function code here ....
}
and then specify the actual CRON expression in the Azure portal - but no go, the CRON expression is mandatory....
So am I asking for too much here? Or is there a way to schedule this outside of my actual code base?