You can run programs or scripts in WebJobs in your App Service web app in three ways: on demand, continuously, or on a schedule. There is no additional cost to use WebJobs.
This article shows how to deploy WebJobs by using the Azure Portal. For information about how to deploy by using Visual Studio or a continuous delivery process, see How to Deploy Azure WebJobs to Web Apps.
The Azure WebJobs SDK simplifies many WebJobs programming tasks. For more information, see What is the WebJobs SDK.
The following file types are accepted:
In the Web App blade of the Azure Portal, click All settings > WebJobs to show the WebJobs blade.
Click Add. The Add WebJob dialog appears.
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 How to Run box, choose Run on Demand.
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.
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.
To run the WebJob, right-click its name in the list and click Run.
To create a continuously executing WebJob, follow the same steps for creating a WebJob that runs once, but in the How to Run box, choose Continuous.
To start or stop a continuous WebJob, right-click the WebJob in the list and click Start or Stop.
If your web app runs on more than one instance, a continuously running WebJob will run on all of your instances. On-demand and scheduled WebJobs run on a single instance selected for load balancing by Microsoft Azure.
For Continuous WebJobs to run reliably and on all instances, enable the Always On* configuration setting for the web app otherwise they can stop running when the SCM host site has been idle for too long.
The Azure management portal doesn't yet have the ability to create a scheduled WebJob, but until that feature is added you can do it by using the old portal.
In the old portal go to the WebJob page and click Add.
In the How to Run box, choose Run on a schedule.
Choose the Scheduler Region for your job, and then click the arrow on the bottom right of the dialog to proceed to the next screen.
In the Create Job dialog, choose the type of Recurrence you want: One-time job or Recurring job.
Also choose a Starting time: Now or At a specific time.
If you want to start at a specific time, choose your starting time values under Starting On.
If you chose a recurring job, you have the Recur Every option to specify the frequency of occurrence and the Ending On option to specify an ending time.
If you choose Weeks, you can select the On a Particular Schedule box and specify the days of the week that you want the job to run.
If you choose Months and select the On a Particular Schedule box, you can set the job to run on particular numbered Days in the month.
If you choose Week Days, you can select which day or days of the week in the month you want the job to run on.
Finally, you can also use the Occurrences option to choose which week in the month (first, second, third etc.) you want the job to run on the week days you specified.
After you have created one or more jobs, their names will appear on the WebJobs tab with their status, schedule type, and other information. Historical information for the last 30 WebJobs is maintained.
Scheduled jobs can be further configured in the Azure Scheduler pages of the old portal.
On the WebJobs page, click the job's schedule link to navigate to the Azure Scheduler portal page.
On the Scheduler page, click the job.
The Job Action page opens, where you can further configure the job.
To view the execution history of a job, including jobs created with the WebJobs SDK, click its corresponding link under the Logs column of the WebJobs blade. (You can use the clipboard icon to copy the URL of the log file page to the clipboard if you wish.)
Clicking the link opens the details page for the WebJob. This page shows you the name of the command run, the last times it ran, and its success or failure. Under Recent job runs, click a time to see further details.
The WebJob Run Details page appears. Click Toggle Output to see the text of the log contents. The output log is in text format.
To see the output text in a separate browser window, click the download link. To download the text itself, right-click the link and use your browser options to save the file contents.
The WebJobs link at the top of the page provides a convenient way to get to a list of WebJobs on the history dashboard.
Clicking one of these links takes you to the WebJob Details page for the job you selected.
If you want to get started with Azure App Service before signing up for an Azure account, go to Try App Service, where you can immediately create a short-lived starter web app in App Service. No credit cards required; no commitments.
For more information, see Azure WebJobs Recommended Resources.