I have a script located in my nodejs application that needs to be run at specific time intervals to update some values in the database. I use node-cron
library to successfully schedule this script to run locally but I haven’t been able to find a suitable way to get this script to run at the specified time intervals when the nodejs application is deployed to Azure. Any help resolving this would be appreciated.
2
Answers
You can use Azure Functions with a timer trigger, Azure App Service background tasks, Azure Container Instances to achieve the same result in Azure. There are several other ways to do that, but they would be more complicated to setup and maintain.
I’d probably go for Azure Function and a timer trigger.
I do agree with @4c74356b41 that we can use azure timer trigger functions for it and I followed Microsoft-Document:
After changing then code then you can Publish it to Azure Functions in Portal and then you can run it in cloud.
Alternatively you can use Logic apps for executing code in regular intervals of time :
In logic apps you can use recurrence trigger:
Then in next step you can call your function app to run it.