Search code examples
azurescheduled-taskswebjob

Porting multiple windows scheduled tasks from a VM to a single web job


I'm reasonably new to Azure and I'm just wanting to confirm I'm on the right track when wanting to port multiple windows scheduled tasks to web jobs.

Currently I deploy my (c#) project to a single directory on a VM, and have a series of scheduled tasks that run on various schedules, using scheduled task arguments to determine what task gets run.

I would like to port this to web jobs (or any other relevant Azure serverless app) but the only way I see it working is creating a single web job per scheduled job. This will be a real pain when making code changes and having to deploy to 20-30 different locations (one per web job).

Is there a way of doing this that give me the equivalent of multiple windows schedules tasks running the same exe? I was thinking possibly having a settings.job file with multiple schedules and each schedule having optional arguments, but it doesn't look like this is possible.

Is the only way to skin this to create a separate web job per scheduled task and then copy the code up to each web job directory, or am I missing an easier way?

Thanks for any help on this

Steve


Solution

  • The samples over at https://github.com/Azure/azure-webjobs-sdk-samples/tree/master/BasicSamples can give you a basic idea. But from what you've said, I think you can add different scheduled triggers (Timer, Queue) in a Functions.cs that's added your C# console project. Check out this quick start guide as well in addition to reviewing the BasicSamples repo.

    When it comes to your task arguments, I would look at using Azure Storage Tables and bind the table to your [TimerTrigger] to pull the argument data so the "function" knows what to do.

    You can publish your project as a webjob and each trigger in Functions.cs should show up under the Web Jobs blade of App Service you deployed to.