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 prebuilt samples available in multiple languages and platforms.

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 a sample based on your App Service platform. All Windows samples can run in all Windows code apps, regardless of the stack you choose. Linux stack-specific samples (such as .NET, Node.js, Python, PHP, and Java) can run in the Linux container that comes with your chosen stack.

Each sample prints the current system date and time in a consistent format.

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