Azure WebJobs

What is an Azure WebJob?  With WebJobs, you can simply run a program or script just like a running a web app. Azure Functions is also a similar service. You can create a console app and run it continuously or triggered. Let’s try a simple one.

  • Create the console app: dotnet new console
  • Write your code. Console.WriteLine outputs to WebJobs logs page. So you can use that to log simply.
  • Publish the project: dotnet publish -c Release
  • Add a new file with extension .cms, such as Run.cmd in the publish folder – we do this because webjobs do not run dll files directly. It will run this script file.
  • Add the command to run your dll: dotnet YourProject.dll
  • Zip the publish file:
  • Follow these steps to upload it to Azure and run it:
  • You can use CRON expression for triggered jobs:

Every 15 minutes: 0 */15 * * * *
Every hour (that is, whenever the count of minutes is 0): 0 0 * * * *
Every hour from 9 AM to 5 PM: 0 0 9-17 * * *
At 9:30 AM every day: 0 30 9 * * *
At 9:30 AM every weekday: 0 30 9 * * 1-5

For more advanced features, you can use WebJobs SDK:



WebJobs vs. Functions:

CRON Expressions Cheat Sheet:

#azure #azure-functions, #azure-webjobs, #webjobs