Skip to content

Commit 76d80b0

Browse files
committed
kudu migration
1 parent 4e66632 commit 76d80b0

File tree

5 files changed

+167
-54
lines changed

5 files changed

+167
-54
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
author: msangapu-msft
3+
ms.service: azure-app-service
4+
ms.topic: include
5+
ms.date: 05/01/2025
6+
ms.author: msangapu
7+
---
8+
9+
### <a name="acceptablefiles"></a>Supported file types for scripts or programs
10+
11+
### [Windows code](#tab/windowscode)
12+
13+
The following file types are supported:
14+
15+
- Using Windows cmd: *.cmd*, *.bat*, *.exe*
16+
- Using PowerShell: *.ps1*
17+
- Using Bash: *.sh*
18+
- Using Node.js: *.js*
19+
- Using Java: *.jar*
20+
21+
The necessary runtimes to run these file types are already installed on the web app instance.
22+
23+
### [Windows container](#tab/windowscontainer)
24+
25+
The following file types are supported using Windows cmd: *.cmd*, *.bat*, *.exe*
26+
27+
In addition to these file types, WebJobs written in the language runtime of the Windows container app are supported.
28+
29+
- Example: *.jar* and *.war* scripts are supported if the container is a Java app.
30+
31+
### [Linux code](#tab/linuxcode)
32+
33+
*.sh* scripts are supported.
34+
35+
In addition to shell scripts, WebJobs written in the language of the selected runtime are also supported.
36+
37+
- Example: Python (*.py*) scripts are supported if the main site is a Python app.
38+
39+
### [Linux container](#tab/linuxcontainer)
40+
41+
*.sh* scripts are supported.
42+
43+
In addition to shell scripts, WebJobs written in the language runtime of the Linux container app are also supported.
44+
45+
- Example: Node (*.js*) scripts are supported if the site is a Node.js app.
46+
47+
---

articles/app-service/overview-webjobs.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ Azure WebJobs is a built-in feature of Azure App Service that enables you to run
1717

1818
## WebJob types
1919
WebJobs come in two primary types:
20-
- **Triggered WebJobs:** Run on demand, on a schedule, or in response to specific events.
21-
- **Continuous WebJobs:** Operate perpetually, ensuring that critical background processes are always active.
20+
- Triggered WebJobs: Run on demand, on a schedule, or in response to specific events.
21+
- Continuous WebJobs: Operate perpetually, ensuring that critical background processes are always active.
2222

2323
For scheduled tasks, NCRONTAB expressions are used to define precise execution intervals, giving you fine-grained control over when the jobs run.
2424

@@ -30,13 +30,20 @@ Supported file types include:
3030
- PowerShell scripts (`.ps1`)
3131
- Bash scripts (`.sh`)
3232
- Scripting languages such as Python (`.py`), PHP (`.php`), Node.js (`.js`), and F# (`.fsx`)
33+
- WebJobs written in the language runtime of the Windows/Linux container app.
3334

3435
This versatility enables integration of WebJobs into a wide range of application architectures.
3536

3637
## Benefits and deployment
37-
By incorporating WebJobs into your App Service, you reduce operational overhead while gaining robust capabilities for background processing. Deployment options are flexible and include:
38-
- **Visual Studio Integration:** Seamlessly deploy WebJobs alongside your ASP.NET applications.
39-
- **Azure Portal and ZIP Deployment:** Easily upload and deploy your WebJob packages.
40-
- **Automated Pipelines:** Use ARM templates or Git for automated deployments.
41-
42-
Additionally, WebJobs provide built-in logging and monitoring, as well as seamless integration with other Azure services, making them a cost-effective and efficient solution for automating background tasks.
38+
WebJobs provide a straightforward way to run background tasks as part of your App Service app, without needing separate infrastructure. They support various deployment methods depending on your workflow:
39+
40+
- Visual Studio: Supports direct deployment of WebJobs along with ASP.NET apps on Windows App Service.
41+
- Azure portal or ZIP upload: Upload a .zip package containing your script or executable and trigger configuration.
42+
- Automation tools: WebJobs can be deployed using ARM templates, Git, or CI/CD pipelines (like GitHub Actions or Azure DevOps).
43+
- Built-in logging and integration with Kudu make it easy to monitor execution and troubleshoot issues.
44+
- Additionally, WebJobs provide built-in logging and monitoring, as well as seamless integration with other Azure services, making them a practical solution for automating background tasks.
45+
46+
## <a name="NextSteps"></a> Next step
47+
[Create a scheduled WebJob](quickstart-webjobs.md).
48+
[Build a custom scheduled WebJob from scratch using .NET, Python, Node.js, Java, or PHP](tutorial-webjobs.md).
49+
[How to run background tasks with WebJobs](webjobs-create.md).

articles/app-service/toc.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -463,23 +463,25 @@ items:
463463
href: invoke-openapi-web-app-from-azure-ai-agent-service.md
464464
- name: WebJobs
465465
items:
466-
- name: Overview
466+
- name: Overview
467467
href: overview-webjobs.md
468468
displayName: WebJobs overview
469469
- name: WebJobs Quickstart
470470
href: quickstart-webjobs.md
471471
displayName: Create a scheduled WebJob
472+
- name: How to create WebJobs
473+
href: webjobs-create.md
474+
- name: How WebJobs work
475+
href: webjobs-create.md
472476
- name: WebJobs Tutorial
473-
href: tutorial-webjobs.md
477+
href: tutorial-webjobs.md
474478
displayName: Prepare and schedule a WebJob
475-
- name: WebJobs How-to
476-
href: webjobs-create.md
477479
- name: Develop WebJobs using VS
478480
href: webjobs-dotnet-deploy-vs.md
479481
- name: Get started with WebJobs SDK
480482
href: webjobs-sdk-get-started.md
481483
- name: Use WebJobs SDK
482-
href: webjobs-sdk-how-to.md
484+
href: webjobs-sdk-how-to.md
483485
- name: Reliability
484486
items:
485487
- name: Reliability in Azure App Service

articles/app-service/webjobs-create.md

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -26,45 +26,7 @@ Azure Functions provides another way to run programs and scripts. For a comparis
2626

2727
## WebJob types
2828

29-
### <a name="acceptablefiles"></a>Supported file types for scripts or programs
30-
31-
### [Windows code](#tab/windowscode)
32-
33-
The following file types are supported:
34-
35-
- Using Windows cmd: *.cmd*, *.bat*, *.exe*
36-
- Using PowerShell: *.ps1*
37-
- Using Bash: *.sh*
38-
- Using Node.js: *.js*
39-
- Using Java: *.jar*
40-
41-
The necessary runtimes to run these file types are already installed on the web app instance.
42-
43-
### [Windows container](#tab/windowscontainer)
44-
45-
The following file types are supported using Windows cmd: *.cmd*, *.bat*, *.exe*
46-
47-
In addition to these file types, WebJobs written in the language runtime of the Windows container app are supported.
48-
49-
- Example: *.jar* and *.war* scripts are supported if the container is a Java app.
50-
51-
### [Linux code](#tab/linuxcode)
52-
53-
*.sh* scripts are supported.
54-
55-
In addition to shell scripts, WebJobs written in the language of the selected runtime are also supported.
56-
57-
- Example: Python (*.py*) scripts are supported if the main site is a Python app.
58-
59-
### [Linux container](#tab/linuxcontainer)
60-
61-
*.sh* scripts are supported.
62-
63-
In addition to shell scripts, WebJobs written in the language runtime of the Linux container app are also supported.
64-
65-
- Example: Node (*.js*) scripts are supported if the site is a Node.js app.
66-
67-
---
29+
[!INCLUDE [webjob-types](./includes/webjobs-create/quickstart-php-windows-pivot.md)]
6830

6931
### Continuous vs. triggered WebJobs
7032

@@ -79,8 +41,6 @@ The following table describes the differences between *continuous* and *triggere
7941

8042
[!INCLUDE [webjobs-always-on-note](../../includes/webjobs-always-on-note.md)]
8143

82-
83-
8444
## <a name="CreateContinuous"></a> Create a continuous WebJob
8545

8646
<!--
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
title: How WebJobs run in Azure App Service
3+
description: Understand how WebJobs are discovered, triggered, and managed by the Kudu engine in Azure App Service.
4+
ms.topic: conceptual
5+
ms.service: app-service
6+
author: msangapu-msft
7+
ms.author: msangapu
8+
ms.date: 05/01/2025
9+
---
10+
11+
# How WebJobs run in Azure App Service
12+
13+
Azure WebJobs allow you to run background tasks within your App Service app, without needing separate infrastructure. These tasks are discovered and managed by the **Kudu engine**, which handles execution, monitoring, and log collection.
14+
15+
This article explains how WebJobs are discovered, how the runtime decides what to execute, and how you can configure behavior using the optional `settings.job` file.
16+
17+
## Job discovery and folder structure
18+
19+
WebJobs are stored in the `site/wwwroot/App_Data/jobs/` folder of your App Service app. There are two subfolders:
20+
21+
- `continuous/`: For long-running jobs that start automatically and run continuously.
22+
- `triggered/`: For jobs that run on-demand or on a schedule.
23+
24+
Each job has its own subfolder under the corresponding type, named after the WebJob. For example:
25+
26+
```
27+
App_Data/jobs/triggered/myjob/
28+
App_Data/jobs/continuous/myjob/
29+
```
30+
31+
Inside the job folder, the Kudu engine looks for a file to execute. This file can be a script or executable.
32+
33+
## Entry point detection
34+
35+
The WebJob runtime executes the **first valid script or binary** it finds based on this order:
36+
37+
1. `run.cmd`
38+
2. `run.bat`
39+
3. `run.exe`
40+
4. `run.ps1`
41+
5. `run.sh`
42+
6. `run.py`
43+
7. `run.php`
44+
8. `run.js`
45+
9. `run.fsx`
46+
47+
> [NOTE] The file must be named exactly `run.*` — not `start.sh` or `job.py`.
48+
49+
The platform uses a run.* file (such as run.sh, run.py, or run.js) as the entry point for a WebJob. If no recognized run.* file is present, it may attempt to execute the first supported script file it finds in the archive. This fallback behavior can be unpredictable—especially when multiple script files are included—so it's strongly recommended to explicitly define a run.* file to ensure reliable execution. On Linux, `.sh` scripts must have a shebang (`#!`) and executable permissions.
50+
51+
## WebJob configuration with settings.job
52+
53+
You can customize WebJob behavior using an optional `settings.job` file (JSON format) placed in the job's root folder. This file supports several properties:
54+
55+
| Property | Description |
56+
|----------|-------------|
57+
| `is_singleton` | (bool) Ensures only one instance of the job runs across all scaled-out instances. Default: `true`. |
58+
| `stopping_wait_time` | (number, seconds) Grace period before the job is killed on shutdown. |
59+
| `shutdownGraceTimeLimit` | (number, seconds) Max time given for shutdown before process is forcefully terminated. |
60+
| `run_mode` | (string) Values: `continuous`, `scheduled`, `on_demand`. Overrides job type detection. |
61+
62+
### Example
63+
```json
64+
{
65+
"is_singleton": true,
66+
"stopping_wait_time": 10,
67+
"shutdownGraceTimeLimit": 20,
68+
"run_mode": "scheduled"
69+
}
70+
```
71+
72+
## Logging and diagnostics
73+
74+
WebJob logs are handled by the Kudu engine and are available under the `App_Data/jobs/<type>/<jobname>` folder. Additionally, logs can be viewed in the Azure portal or accessed via the SCM (Kudu) endpoint:
75+
76+
```
77+
https://<your-app>.scm.azurewebsites.net/api/triggeredwebjobs/<job>/history
78+
```
79+
80+
Triggered WebJobs include a full history of executions. Continuous WebJobs stream logs in real time.
81+
82+
## Platform-specific notes
83+
84+
[!INCLUDE [webjob-types](./includes/webjobs-create/quickstart-php-windows-pivot.md)]
85+
86+
## Troubleshooting tips
87+
88+
- **WebJob not starting:** Check for a missing or misnamed `run.*` file.
89+
- **Permissions error (Linux):** Ensure the script has execute permissions.
90+
- **Job not stopping gracefully:** Use `settings.job` to define shutdown grace period.
91+
92+
## See also
93+
94+
- [WebJobs overview](./overview.md)
95+
- [Create a scheduled WebJob](./scheduled-webjob-quickstart.md)
96+
- [Kudu WebJobs wiki (GitHub)](https://github.com/projectkudu/kudu/wiki/WebJobs)
97+

0 commit comments

Comments
 (0)