Introduction to Azure WebJobs

Azure WebJobs to me are same old Windows Services, but better! Hosted in the Azure cloud with tons of features around them, like debugging…

Introduction to Azure WebJobs

Azure WebJobs to me are same old Windows Services, but better! Hosted in the Azure cloud with tons of features around them, like debugging, scaling, scheduling, instrumentation and so on.

Azure Webjobs lets us run scripts or programs as background processes on App Service Web Apps. You can simply upload and run an executable file such as as cmd, bat, exe (.NET), ps1, sh, php, py, js and jar. These programs run as WebJobs on a schedule or continuously based on your preference.

How to create one?

Well, you can’t create a WebJob on its own! That would be Azure Function if you want to do that. A webJob will be a service running along with a Web App that you are hosting in Azure.

So, select the Web App, then select the WebJobs menu and on the right hand you will see the list of WebJobs uner this Web App. Yes you can have many WebJobs under one Web App!

Now, click Add to add a new WebJob.

Under Name, provide a name for the WebJob. The name must start with a letter or a number and cannot contain any special characters other than “-” and “_”.

In the File Upload box, click the folder icon and browse to the zip file that contains your script. The zip file should contain your executable (.exe .cmd .bat .sh .php .py .js) as well as any supporting files needed to run the program or script.

In the Type box, choose your preferred option Continuous or Triggered (the trigger can be using a Schedule or manual).

Check Create to upload the script to your web app. The name you specified for the WebJob appears in the list on the WebJobs blade.

After you deployed your WebJob, you can use the dashboard in the Azure portal, that gives you full control over the execution of WebJobs, including the ability to invoke individual functions within WebJobs. The dashboard also displays function runtimes and logging output.

You can use the WebJobs SDK is to simplify the code you write for common tasks that a WebJob can perform, such as image processing, queue processing, RSS aggregation, file maintenance, and sending emails. The WebJobs SDK has built-in features for working with Azure Storage and Service Bus, for scheduling tasks and handling errors, and for many other common scenarios.