WebJobs is a feature of Azure App Service that enables you to run a program or script in the same instance as a web app. All app service plans support WebJobs. There's no extra cost to use WebJobs. This sample uses a Triggered (scheduled) WebJob to output the system time once every 15 minutes.
WebJobs Intro
WebJobs is a feature of Azure App Service that enables you to run a program or script in the same instance as a web app. All app service plans support WebJobs. There's no extra cost to use WebJobs. This sample uses a Triggered (scheduled) WebJob to output the system time once every 15 minutes.
Create Web App
Before creating our WebJobs, we need to create an App Service webapp. If you already have an App Service Web App, skip to the next step Otherwise, in the portal, select App Services > Create > Web App. After following the create instructions and selecting a runtime stack (does not matter for this example…we’ll do a more in-depth sample later), create your App Service Web App.
Next, we’ll add a basic WebJob to our app.
Create WebJob Script
Before we do anything else, let’s write our WebJob script. This will execute every time our WebJob is triggered. WebJobs on App Service can be run on a Triggered (Scheduled) basis or Continuously. This example uses a Triggered WebJob. Sample code below:
#!/bin/bash
# This script outputs the system time to the console
# Get the current system time
current_time=$(date)
# Output the current time to console
echo "Current system time: $current_time"
Save this as webjob.sh, next we’ll upload it to the portal.
Create WebJob in Portal
Start by entering your Web App overview page. Then, under Settings select WebJobs. Here we can create and manage our App Service WebJobs for this Web App. Click Add to create a new WebJob.
Now we can name our WebJob, upload our script from the previous step, and choose our execution type. Under Type, select Triggered. Under CRON Expression, enter the following to trigger our WebJob once every 15 minutes.
0 */15 * * * *
Note: These are NCRONTAB expressions, not standard Linux CRONTAB expressions. An important distinction.
Now click Create WebJob to finish making our new WebJob. Let’s test it out now.
Run Manually or Scheduled
To manually test our WebJob, we can click the play button under Run. A status of Completed means that WebJob is finished.
Confirm Results in Logs
We can check the logs to confirm that the system time was output to the console.
While this is a basic example, WebJobs are a powerful and easy to use feature that have incredible utility for running scheduled (or continuous) actions in conjunction with your App Service Web Apps at no additional cost.
Learn more about WebJobs on App Service
Updated Mar 11, 2025
Version 1.0denverbrittain
Microsoft
Joined June 23, 2022
Apps on Azure Blog
Follow this blog board to get notified when there's new activity