I have requirement to develop Azure Function App which is able to run on schedule also when needed User can manually run it. Please share the view how I can implement it.
Function App which runs on schedule also need to run manually
538 views Asked by Swap At
2
There are 2 answers
0
On
@Swap you should read up on TimerTriggers here: https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer?tabs=csharp#example
A TimerTrigger
allows you to define a repeatable event which you can also run manually from the Azure portal.
It sounds like you might need a better solution altogether as Hury suggested. You might want to read up on Logic Apps which can be used as a web job for a standard HttpTrigger
.
Creating a HttpTrigger
function allows you to manually, or programmatically, trigger the method. You can use LogicApps
to trigger the same function on a schedule.
I think there might be several ways to help you...
Maybe if you provide more detail on what you are trying accomplish?
For this requirement, I don't think we can do it in one function. You need to create a HTTP trigger function and write the code in it. And create another timer trigger function, request the http trigger function url in the timer trigger function.
When you want to run it manually, request the http trigger function url. And the timer trigger function will also be scheduled to run according to the cron expression you specified.