Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manually trigger time based Azure Functions on dev [duplicate]

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.

like image 401
scorpion5211 Avatar asked Sep 07 '18 21:09

scorpion5211


People also ask

How do I trigger a timer trigger Azure function manually?

Navigate to your function app in the Azure portal, select App Keys, and then the _master key. In the Edit key section, copy the key value to your clipboard, and then select OK. After copying the _master key, select Code + Test, and then select Logs.

How do you run a manual timer trigger?

If you want to call admin API to trigger your timer function, you need to add your function master key in your request or you'll get 401 Unauthorized. Find it on Function app settings panel >Host Keys (All functions)> _master. Add it in your request header x-functions-key:<masterkey> .

Can an Azure function have two triggers?

There are no plans to support multiple triggers per Function. You will have to create a Function for each EventHub. If there is common code that may be shared between Functions, you may move them to a helper method that can be called from each Function.

How do you run a timer trigger Azure function locally in Visual Studio 2019?

Go to the Azure icon in the Activity bar. Under Local Project , find the function you want to run, right click, and select "Execute Function Now".


2 Answers

It doesn't look like there is a direct solution available to manually (or even through and http request) trigger a time based Azure function.

Possible Workaround

Have a second http triggered function that has the same logic/code. You can use this 2nd function for testing on demand basis.

Please see the discussion in these 2 threads, it's very relevant to you -

Any method for testing timer trigger function

Time triggered azure function to trigger immediately after deploy

like image 31
Rohit Saigal Avatar answered Sep 24 '22 06:09

Rohit Saigal


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

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

That should kick it off on startup.

like image 186
tokyo0709 Avatar answered Sep 23 '22 06:09

tokyo0709