Quickstart: Create a scheduled WebJob

WebJobs in Azure App Service let you run scripts or programs as background tasks. In this quickstart, you create a scheduled WebJob that prints the current time, using a prebuilt script for either Windows or Linux.

Prerequisites

  • An Azure account. Create an account.
  • An existing App Service app running on your preferred OS:
    • Windows App Service (any stack: code or container)
    • Linux App Service (any stack: code or container)
  • Enable Always On in the App Service settings: Configure Always On
  • For Windows containers and all Linux apps, set the app setting WEBSITE_SKIP_RUNNING_KUDUAGENT = false

Download a sample WebJob

Choose the version that matches your App Service OS:

Platform Download link Included script
Windows Download CMD version run.cmd (uses echo %date% %time%)
Linux Download Bash version run.sh (uses date)

Each zip contains a single script that prints the current system date and time.

Add the WebJob in the Azure portal

  1. In the Azure portal, go to your App Service app.

  2. In the left menu, select WebJobs > + Add.

  3. Fill in the form with the following values:

    Setting Value
    Name webjob
    File Upload The .zip file you downloaded
    Type Triggered
    Triggers Scheduled
    CRON Expression 0 0/1 * * * *
  4. Select OK to create the WebJob.

Verify the WebJob

  1. Go to the WebJobs tab.
  2. Select your WebJob and open Logs.
  3. Confirm that it runs every minute and prints the system time.

Clean up

To remove the WebJob, select the WebJob in the portal and select Delete.

Next step

Build a custom scheduled WebJob from scratch using .NET, Python, Node.js, Java, or PHP