I am working on azure functions. I have two azure function one is http Api and the second one is timer trigger function hosted in same function app:
Function.json of timer trigger function :
{
"bindings": [
{
"name": "myTimer",
"type": "timerTrigger",
"direction": "in",
"schedule": "0 */1 * * * *"
}
]
}
I want to below functionality :
Ex: In above function.json schedule is "0 */1 * * * *" to "0 */5 * * * *" 2. Enable/Disable : I want to enable/ disable timer function from Function A. 3. Input : provide input also to the request.
Is there any way I can achieve above points programmatically ?
Thank You!
Change schedule : From function A at runtime I want to change the schedule time of timer function.
Firstly, Schedule in functions is used only in Timer Trigger Function you can't use it in HTTP function so you can't change the schedule through HTTP Trigger Function you can refer this SO for further details.
Rather you can use Azure logic apps for changing the schedule value using logic apps for complete information here is the document for Azure Scheduler.
To enable or disable Azure function programmatically you need to change the format in app setting and add below code.
AzureWebJobs.<FUNCTION_NAME>.Disabled : True
You need to add the above code in Function.JSON file for further details you can refer this document which includes complete information regarding enable/disable azure function.
Here is the output after testing in my local environment.
