Manually trigger time based Azure Functions on dev

Viewed 4220

My task runs once a day when deployed. For development currently I just changed the CRON to "every minute" and wait for that minute to hit in order for the function to be triggered for me to do the debugging. Is there a way such that I can leave my timer code to stay as "Every day" but still be able to kick it off manually.

In Azure I can just go to the function resource and click "Run" that will start it regardless of the timer. I am looking for something similar on my dev.

3 Answers

You are probably looking for this on the Timer Trigger attribute,

[TimerTrigger("", RunOnStartup = true)]TimerInfo timer

That should kick it off on startup.

As @neo99 mentioned, simple answer is it is not possible just out of the box. The reason is input parameters for Run method of Trigger function are different for different type of triggers.

For e.g. you are looking to manually trigger(HttpTrigger) a TimerTrigger

Timer Trigger:

[FunctionName("TimerTriggerCSharp")]
public static void Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer, TraceWriter log)

Http Trigger:

[FunctionName("HttpTriggerCSharp")]
public static async Task<HttpResponseMessage> Run(
    [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequestMessage req, 
    TraceWriter log)
Related