In this article, we will learn how to develop Azure WebJobs in VS Code and deploy them in Azure App Service.

What is Azure WebJob?
Azure WebJob enables you to run a script or code snippet in the background. It runs in the same instance as a web app, which means we do not require any separate infrastructure or Azure service for this.
How to create Web Jobs?
In this section, we will see how to create WebJobs in Visual Studio or VS Code.
Create WebJobs in Visual Studio
In Visual Studio 2022, you will find Azure WebJob project template under cloud project type. Start writing your code or you can create a console application and write your code within it. Once you build the application then zip the publish folder. Next, we will deploy our code/ script to Azure WebJob.
How to deploy WebJobs to Azure?
Follow below steps to deploy WebJobs in Azure.
- Once you are ready with your code.
- Build the code in release mode.
- Zip the publish folder
- Go to Azure portal and then App Service on which you will run the code.
- In App service, you will find WebJobs in the left side item, click on that.
- Once the WebJob page is ready, Click on Add New.
- In the new form, give a name of the Job and select the path of Zip folder. Select your WebJob running criteria.
- You are done with creating Azure WebJobs

While setting schedule criteria, if you select Scheduled as Triggers, you must provide the CRON expression.

What is CRON expression in Azure WebJob?
CRON expression in WebJob is used to define the interval of WebJob. CRON expression is a six-field format as shown below:
{second} {minute} {hour} {day} {month} {day-of-week}
So, if you want to set 5-minute intervals i.e. every 5 minutes the WebJob should execute, then the CRON expression will be like this:
0 */5 * * * *
Summary
So, by reading this article, you may now create WebJobs in Azure. This is a new way to create a scheduler. The major benefit of Azure WebJob is that it doesn’t require any separate infrastructure. If you have an App service in Azure, then it is sufficient to create and schedule WebJobs.
Hope you like this article. Share your feedback in the comment box below.
Keep following – SharePointCafe.NET