How do I configure and run a triggered WebJob from a Linux custom container image on an Azure App Service staging slot?

ArifA-4489 0 نقاط السُمعة
2026-11-03T22:10:55.8566667+00:00

We have a healthy Azure App Service running a Linux custom container on a staging slot. WebJobs are currently disabled, and WEBJOBS_ROOT_PATH is unset. We want to package run.sh in the application image and trigger it manually after verifying that Azure can discover it.

For example, the image would contain /opt/example/App_Data/jobs/triggered/sample-job/run.sh, with no copy under /home/site/wwwroot. Could you provide a minimal working example for this setup, covering the following?

  1. Supported layout. Can the WebJobs executor discover the script directly from /opt inside the image? Does discovery work differently on a staging slot than on the default slot? If this layout is unsupported, where should the job files be deployed?
  2. Required settings. Which settings must be configured, what values should they have, and which can keep their defaults? In particular, please clarify webJobsEnabled, WEBSITE_SKIP_RUNNING_KUDUAGENT, WEBJOBS_ROOT_PATH, and WEBSITES_ENABLE_APP_SERVICE_STORAGE. For the example above, which directory should WEBJOBS_ROOT_PATH point to, and which path components does Azure append? Which settings should be marked as deployment slot settings?
  3. How it runs. What should the Dockerfile and run.sh contain, including the required file permissions? Which component discovers the script, and in which container does the script actually run?
  4. How to verify and trigger it. Can discovery be checked while WebJobs are disabled? If enabling WebJobs is required, can we first confirm that sample-job is listed without executing it, then trigger it manually on the staging slot and check its status and logs? Does the Kudu Bash console see the same files as the executor? An official reference or a tested example showing the folder layout, configuration values, and steps for the staging slot would be appreciated.
مركز المجتمع | غير مُراقَب
0 تعليقات ليست هناك تعليقات

إجابة واحدة

فرز حسب: الأكثر فائدة
  1. Reem Abdelkader 0 نقاط السُمعة
    2026-11-05T02:23:17.1433333+00:00

    Supported layout: Placing the job directly under /opt/example/App_Data/jobs/... inside the image without mirroring it under /home is generally not supported out of the box by the WebJobs executor. Azure App Service relies on persistent storage mounted at /home for runtime file discovery and execution (e.g., /home/site/wwwroot/App_Data/jobs/triggered/sample-job/). You should package or deploy your job files under /home/site/wwwroot/App_Data/jobs/triggered/.

    Required settings:

    webJobsEnabled: Must be set to true to enable the WebJobs runtime.

    WEBSITE_SKIP_RUNNING_KUDUAGENT: Can be left as default (false), as Kudu needs to run to manage the jobs.

    WEBSITES_ENABLE_APP_SERVICE_STORAGE: Must be set to true to ensure proper network storage mounting for /home.

    WEBJOBS_ROOT_PATH: Can usually remain unset if you stick to the standard /home/site/wwwroot/App_Data structure.

    Slot Settings: Make sure to mark application settings related to WebJobs and custom paths as Deployment Slot Settings so they don't get overwritten during a slot swap.

    How it runs:

    Your Dockerfile should place the files in the correct directory, and run.sh must have execution permissions (chmod +x run.sh).

    The Kudu/WebJobs manager discovers the script, and it executes inside the app container instance where persistent storage is accessible.

    How to verify and trigger it:

    WebJobs discovery typically requires webJobsEnabled to be active.

    Once enabled, you can check the WebJobs list via the Azure Portal or the Kudu dashboard without triggering it immediately, then trigger it manually and inspect the execution logs.

    The Kudu Bash console (https://<app-name>-staging.scm.azurewebsites.net) shares the same /home persistent storage view as the executor."

    هل كانت هذه الإجابة مفيدة؟

    0 تعليقات ليست هناك تعليقات

إجابتك

يمكن وضع علامة على الأجوبة 'كمقبولة' من قبل كاتب السؤال و'مستحسنة' من قبل المشرفين، مما يساعد المستخدمين على معرفة الإجابة التي حلت مشكلة الكاتب.