You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/app-service/deploy-zip.md
+42-43Lines changed: 42 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,12 @@
1
1
---
2
2
title: Deploy files to App Service
3
-
description: Learn to deploy various app packages or discrete libraries, static files, or startup scripts to Azure App Service
3
+
description: Learn to deploy various app packages or discrete libraries, static files, or startup scripts to Azure App Service.
4
4
ms.topic: article
5
-
ms.date: 01/26/2024
5
+
ms.date: 01/24/2025
6
6
ms.custom: devx-track-azurecli
7
7
author: cephalin
8
8
ms.author: cephalin
9
+
#customer intent: As a web app developer, I want to deploy my Azure App Service code as a ZIP, WAR, JAR, or EAR package or deploy individual files.
9
10
---
10
11
11
12
# Deploy files to App Service
@@ -24,54 +25,54 @@ To complete the steps in this article, [create an App Service app](./index.yml),
24
25
25
26
## Deploy a ZIP package
26
27
27
-
When you deploy a ZIP package, App Service unpacks its contents in the default path for your app (`D:\home\site\wwwroot` for Windows, `/home/site/wwwroot` for Linux).
28
+
When you deploy a ZIP package, App Service unpacks its contents in the default path for your app: `D:\home\site\wwwroot` for Windows, `/home/site/wwwroot` for Linux.
28
29
29
-
This ZIP package deployment uses the same Kudu service that powers continuous integration-based deployments. Kudu supports the following functionality for ZIP package deployment:
30
+
This ZIP package deployment uses the same Kudu service that powers continuous integration-based deployments. Kudu supports the following functionality for ZIP package deployment:
30
31
31
32
- Deletion of files left over from a previous deployment.
32
33
- Option to turn on the default build process, which includes package restore.
33
34
- Deployment customization, including running deployment scripts.
34
-
- Deployment logs.
35
-
- A package size limit of 2048 MB.
35
+
- Deployment logs.
36
+
- A package size limit of 2048 megabytes.
36
37
37
38
> [!NOTE]
38
-
> Files in the ZIP package are copied only if their timestamps don't match what is already deployed.
39
+
> Files in the ZIP package are copied only if their timestamps don't match what is already deployed.
39
40
40
-
####With zip deploy UI in Kudu
41
+
### With zip deploy UI in Kudu
41
42
42
-
In the browser, navigate to `https://<app_name>.scm.azurewebsites.net/ZipDeployUI` (see [note at top](#dnl-note)).
43
+
In the browser, navigate to `https://<app_name>.scm.azurewebsites.net/ZipDeployUI`. For the app name, see the [note at top](#dnl-note).
43
44
44
45
Upload the ZIP package you created in [Create a project ZIP package](#create-a-project-zip-package) by dragging it to the file explorer area on the web page.
45
46
46
-
When deployment is in progress, an icon in the top right corner shows you the progress in percentage. The page also shows verbose messages for the operation below the explorer area. When deployment completes, the last message should say `Deployment successful`.
47
+
When deployment is in progress, an icon in the top right corner shows you the progress in percentage. The page also shows verbose messages for the operation below the explorer area. When deployment completes, the last message should say *Deployment successful*.
47
48
48
-
The above endpoint doesn't work for Linux App Services at this time. Consider using FTP or the [ZIP deploy API](./faq-app-service-linux.yml) instead.
49
+
This endpoint doesn't work for Linux App Services at this time. Consider using FTP or the [ZIP deploy API](./faq-app-service-linux.yml) instead.
49
50
50
-
####Without zip deploy UI in Kudu
51
+
### Without zip deploy UI in Kudu
51
52
52
53
# [Azure CLI](#tab/cli)
53
54
54
55
Deploy a ZIP package to your web app by using the [az webapp deploy](/cli/azure/webapp#az-webapp-deploy) command. The CLI command uses the [Kudu publish API](#kudu-publish-api-reference) to deploy the files and can be fully customized.
55
56
56
57
The following example pushes a ZIP package to your site. Specify the path to your local ZIP package for `--src-path`.
57
58
58
-
```azurecli-interactive
59
+
```azurecli
59
60
az webapp deploy --resource-group <group-name> --name <app-name> --src-path <zip-package-path>
60
61
```
61
62
62
-
This command restarts the app after deploying the ZIP package.
63
+
This command restarts the app after deploying the ZIP package.
63
64
64
65
# [Azure PowerShell](#tab/powershell)
65
66
66
-
The following example uses [Publish-AzWebapp](/powershell/module/az.websites/publish-azwebapp) to upload the ZIP package. Replace the placeholders `<group-name>`, `<app-name>`, and `<zip-package-path>`
67
+
The following example uses [Publish-AzWebapp](/powershell/module/az.websites/publish-azwebapp) to upload the ZIP package. Replace the placeholders *\<group-name>*, *\<app-name>*, and *\<zip-package-path>*
The following example uses the cURL tool to deploy a ZIP package. Replace the placeholders `<zip-package-path>` and `<app-name>`. If you choose basic authentication, supply the [deployment credentials](deploy-configure-credentials.md) in `<username>` and `<password>`.
75
+
The following example uses the cURL tool to deploy a ZIP package. Replace the placeholders *\<zip-package-path>* and *\<app-name>*. If you choose basic authentication, supply the [deployment credentials](deploy-configure-credentials.md) in *\<username>* and *\<password>*.
75
76
76
77
```bash
77
78
# Microsoft Entra authentication
@@ -90,7 +91,7 @@ curl -X POST \
90
91
```
91
92
92
93
> [!NOTE]
93
-
> For the actual fully qualified domain name to use in the URL, see [note at top](#dnl-note)
94
+
> For the actual fully qualified domain name to use in the URL, see the [note at top](#dnl-note).
94
95
95
96
# [ARM template](#tab/arm)
96
97
@@ -102,7 +103,7 @@ ARM templates only support [deployments from remotely hosted packages](#deploy-t
102
103
103
104
By default, the deployment engine assumes that a ZIP package is ready to run as-is and doesn't run any build automation. To enable the same build automation as in a [Git deployment](deploy-local-git.md), set the `SCM_DO_BUILD_DURING_DEPLOYMENT` app setting by running the following command in the [Cloud Shell](https://shell.azure.com):
104
105
105
-
```azurecli-interactive
106
+
```azurecli
106
107
az webapp config appsettings set --resource-group <group-name> --name <app-name> --settings SCM_DO_BUILD_DURING_DEPLOYMENT=true
107
108
```
108
109
@@ -112,29 +113,29 @@ For more information, see [Kudu documentation](https://github.com/projectkudu/ku
112
113
113
114
You can deploy your [WAR](https://wikipedia.org/wiki/WAR_(file_format)), [JAR](https://wikipedia.org/wiki/JAR_(file_format)), or [EAR](https://wikipedia.org/wiki/EAR_(file_format)) package to App Service to run your Java web app using the Azure CLI, PowerShell, or the Kudu publish API.
114
115
115
-
The deployment process shown here puts the package on the app's content share with the right naming convention and directory structure (see [Kudu publish API reference](#kudu-publish-api-reference)), and it's the recommended approach. If you deploy WAR/JAR/EAR packages using [FTP](deploy-ftp.md) or WebDeploy instead, you might see unknown failures due to mistakes in the naming or structure.
116
+
The deployment process shown here puts the package on the app's content share with the right naming convention and directory structure. For more information, see [Kudu publish API reference](#kudu-publish-api-reference). We recommend this approach. If you deploy WAR/JAR/EAR packages using [FTP](deploy-ftp.md) or WebDeploy instead, you might see unknown failures due to mistakes in the naming or structure.
116
117
117
118
# [Azure CLI](#tab/cli)
118
119
119
120
Deploy a WAR package to Tomcat or JBoss EAP by using the [az webapp deploy](/cli/azure/webapp#az-webapp-deploy) command. Specify the path to your local Java package for `--src-path`.
120
121
121
-
```azurecli-interactive
122
+
```azurecli
122
123
az webapp deploy --resource-group <group-name> --name <app-name> --src-path ./<package-name>.war
123
124
```
124
125
125
126
The CLI command uses the [Kudu publish API](#kudu-publish-api-reference) to deploy the package and can be fully customized.
126
127
127
128
# [Azure PowerShell](#tab/powershell)
128
129
129
-
The following example uses [Publish-AzWebapp](/powershell/module/az.websites/publish-azwebapp) to upload the .war file. Replace the placeholders `<group-name>`, `<app-name>`, and `<package-path>` (only WAR and JAR files are supported in Azure PowerShell).
130
+
The following example uses [Publish-AzWebapp](/powershell/module/az.websites/publish-azwebapp) to upload the WAR file. Replace the placeholders *\<group-name>*, *\<app-name>*, and *\<package-path>*. Azure PowerShell supports only WAR and JAR files.
The following example uses the cURL tool to deploy a .war, .jar, or .ear file. Replace the placeholders `<file-path>`, `<app-name>`, and `<package-type>` (`war`, `jar`, or `ear`, accordingly). If you choose basic authentication, supply the [deployment credentials](deploy-configure-credentials.md) in `<username>` and `<password>`.
138
+
The following example uses the cURL tool to deploy a WAR, JAR, or EAR file. Replace the placeholders *\<file-path>*, *\<app-name>*, and *\<package-type>* (`war`, `jar`, or `ear`). If you choose basic authentication, supply the [deployment credentials](deploy-configure-credentials.md) in *\<username>* and *\<password>*.
138
139
139
140
```bash
140
141
# Microsoft Entra authentication
@@ -153,9 +154,9 @@ curl -X POST \
153
154
```
154
155
155
156
> [!NOTE]
156
-
> For the actual fully qualified domain name to use in the URL, see [note at top](#dnl-note)
157
+
> For the actual fully qualified domain name to use in the URL, see the [note at top](#dnl-note).
157
158
158
-
For more information, see [Kudu publish API reference](#kudu-publish-api-reference)
159
+
For more information, see [Kudu publish API reference](#kudu-publish-api-reference).
159
160
160
161
# [ARM template](#tab/arm)
161
162
@@ -171,7 +172,7 @@ Deploy a startup script, library, and static file to your web app by using the [
171
172
172
173
If you deploy a startup script this way, App Service automatically uses your script to start your app.
173
174
174
-
The CLI command uses the [Kudu publish API](#kudu-publish-api-reference) to deploy the files and can be fully customized.
175
+
The CLI command uses the [Kudu publish API](#kudu-publish-api-reference) to deploy the files. The command can be fully customized.
175
176
176
177
### Deploy a startup script
177
178
@@ -199,7 +200,7 @@ Not supported. See Azure CLI or Kudu API.
199
200
200
201
### Deploy a startup script
201
202
202
-
The following example uses the cURL tool to deploy a startup file for the application. Replace the placeholders `<startup-file-path>` and `<app-name>`. If you choose basic authentication, supply the [deployment credentials](deploy-configure-credentials.md) in `<username>` and `<password>`.
203
+
The following example uses the cURL tool to deploy a startup file for the application. Replace the placeholders *\<startup-file-path>* and *\<app-name>*. If you choose basic authentication, supply the [deployment credentials](deploy-configure-credentials.md) in *\<username>* and *\<password>*.
203
204
204
205
```bash
205
206
# Microsoft Entra authentication
@@ -218,11 +219,11 @@ curl -X POST \
218
219
```
219
220
220
221
> [!NOTE]
221
-
> For the actual fully qualified domain name to use in the URL, see [note at top](#dnl-note)
222
+
> For the actual fully qualified domain name to use in the URL, see the [note at top](#dnl-note).
222
223
223
224
### Deploy a library file
224
225
225
-
The following example uses the cURL tool to deploy a library file for the application. Replace the placeholders `<lib-file-path>` and `<app-name>`. If you choose basic authentication, supply the [deployment credentials](deploy-configure-credentials.md) in `<username>` and `<password>`.
226
+
The following example uses the cURL tool to deploy a library file for the application. Replace the placeholders *\<lib-file-path>* and *\<app-name>*. If you choose basic authentication, supply the [deployment credentials](deploy-configure-credentials.md) in *\<username>* and *\<password>*.
226
227
227
228
```bash
228
229
# Microsoft Entra authentication
@@ -241,11 +242,11 @@ curl -X POST \
241
242
```
242
243
243
244
> [!NOTE]
244
-
> For the actual fully qualified domain name to use in the URL, see [note at top](#dnl-note)
245
+
> For the actual fully qualified domain name to use in the URL, see [note at top](#dnl-note).
245
246
246
247
### Deploy a static file
247
248
248
-
The following example uses the cURL tool to deploy a config file for the application. Replace the placeholders `<config-file-path>` and `<app-name>`. If you choose basic authentication, supply the [deployment credentials](deploy-configure-credentials.md) in `<username>` and `<password>`.
249
+
The following example uses the cURL tool to deploy a config file for the application. Replace the placeholders *\<config-file-path>* and *\<app-name>*. If you choose basic authentication, supply the [deployment credentials](deploy-configure-credentials.md) in *\<username>* and *\<password>*.
249
250
250
251
```bash
251
252
# Microsoft Entra authentication
@@ -264,7 +265,7 @@ curl -X POST \
264
265
```
265
266
266
267
> [!NOTE]
267
-
> For the actual fully qualified domain name to use in the URL, see [note at top](#dnl-note)
268
+
> For the actual fully qualified domain name to use in the URL, see the [note at top](#dnl-note).
268
269
269
270
# [ARM template](#tab/arm)
270
271
@@ -282,7 +283,7 @@ The remote URL can be any publicly accessible location, but it's best to use a b
282
283
283
284
Use the `az webapp deploy` command like you would in the other sections, but use `--src-url` instead of `--src-path`. The following example uses the `--src-url` parameter to specify the URL of a ZIP file hosted in an Azure Storage account.
284
285
285
-
```azurecli-interactive
286
+
```azurecli
286
287
az webapp deploy --resource-group <group-name> --name <app-name> --src-url "https://storagesample.blob.core.windows.net/sample-container/myapp.zip?sv=2021-10-01&sb&sig=slk22f3UrS823n4kSh8Skjpa7Naj4CG3 --type zip
287
288
```
288
289
@@ -292,7 +293,7 @@ Not supported. See Azure CLI, Kudu API, or ARM template.
292
293
293
294
# [Kudu API](#tab/api)
294
295
295
-
Invoke the [Kudu publish API](#kudu-publish-api-reference) like you would in the other sections, but instead of uploading a file, pass in a JSON object with `packageUri` in the request body. The following examples use this method to specify the URL of a ZIP file hosted in an Azure Storage account. Note the type is still specified as a query string. If you choose basic authentication, supply the [deployment credentials](deploy-configure-credentials.md) in `<username>` and `<password>`.
296
+
Invoke the [Kudu publish API](#kudu-publish-api-reference) like you would in the other sections. Instead of uploading a file, pass in a JSON object with `packageUri` in the request body. The following examples use this method to specify the URL of a ZIP file hosted in an Azure Storage account. The type is still specified as a query string. If you choose basic authentication, supply the [deployment credentials](deploy-configure-credentials.md) in *\<username>* and *\<password>*.
296
297
297
298
```bash
298
299
# Microsoft Entra authentication
@@ -313,11 +314,11 @@ curl -X POST \
313
314
```
314
315
315
316
> [!NOTE]
316
-
> For the actual fully qualified domain name to use in the URL, see [note at top](#dnl-note)
317
+
> For the actual fully qualified domain name to use in the URL, see the [note at top](#dnl-note).
317
318
318
319
# [ARM template](#tab/arm)
319
320
320
-
Add the following JSON to your ARM template. Replace the placeholder `<app-name>`.
321
+
Add the following JSON to your ARM template. Replace the placeholder *\<app-name>*.
321
322
322
323
```json
323
324
{
@@ -347,23 +348,21 @@ Use the following reference to help you configure the properties:
347
348
348
349
## Kudu publish API reference
349
350
350
-
The `publish` Kudu API allows you to specify the same parameters from the CLI command as URL query parameters. To authenticate with the Kudu REST API, it's best to use token authentication, but you can also use basic authentication with your app's [deployment credentials](deploy-configure-credentials.md#userscope).
351
+
The `publish` Kudu API allows you to specify the same parameters from the CLI command as URL query parameters. To authenticate with the Kudu REST API, we recommend token authentication, but you can also use basic authentication with your app's [deployment credentials](deploy-configure-credentials.md#userscope).
351
352
352
353
The following table shows the available query parameters, their allowed values, and descriptions.
| `type` | `war`\|`jar`\|`ear`\|`lib`\|`startup`\|`static`\|`zip` | The type of the artifact being deployed, this sets the default target path and informs the web app how the deployment should be handled. <br/> - `type=zip`: Deploy a ZIP package by unzipping the content to `/home/site/wwwroot`. `target-path` parameter is optional. <br/> - `type=war`: Deploy a WAR package. By default, the WAR package is deployed to `/home/site/wwwroot/app.war`. The target path can be specified with `target-path`. <br/> - `type=jar`: Deploy a JAR package to `/home/site/wwwroot/app.jar`. The `target-path` parameter is ignored <br/> - `type=ear`: Deploy an EAR package to `/home/site/wwwroot/app.ear`. The `target-path` parameter is ignored <br/> - `type=lib`: Deploy a JAR library file. By default, the file is deployed to `/home/site/libs`. The target path can be specified with `target-path`. <br/> - `type=static`: Deploy a static file (such as a script). By default, the file is deployed to `/home/site/wwwroot`. <br/> - `type=startup`: Deploy a script that App Service automatically uses as the startup script for your app. By default, the script is deployed to `D:\home\site\scripts\<name-of-source>` for Windows and `home/site/wwwroot/startup.sh` for Linux. The target path can be specified with `target-path`. | Yes | String |
357
+
| `type` | `war`\|`jar`\|`ear`\|`lib`\|`startup`\|`static`\|`zip` | The type of the artifact being deployed, this sets the default target path and informs the web app how the deployment should be handled. <br/> - `type=zip`: Deploy a ZIP package by unzipping the content to `/home/site/wwwroot`. `target-path` parameter is optional. <br/> - `type=war`: Deploy a WAR package. By default, the WAR package is deployed to `/home/site/wwwroot/app.war`. The target path can be specified with `target-path`. <br/> - `type=jar`: Deploy a JAR package to `/home/site/wwwroot/app.jar`. The `target-path` parameter is ignored <br/> - `type=ear`: Deploy an EAR package to `/home/site/wwwroot/app.ear`. The `target-path` parameter is ignored <br/> - `type=lib`: Deploy a JAR library file. By default, the file is deployed to `/home/site/libs`. The target path can be specified with `target-path`. <br/> - `type=static`: Deploy a static file, such as a script. By default, the file is deployed to `/home/site/wwwroot`. <br/> - `type=startup`: Deploy a script that App Service automatically uses as the startup script for your app. By default, the script is deployed to `D:\home\site\scripts\<name-of-source>` for Windows and `home/site/wwwroot/startup.sh` for Linux. The target path can be specified with `target-path`. | Yes | String |
357
358
|`restart`|`true`\|`false`| By default, the API restarts the app following the deployment operation (`restart=true`). To deploy multiple artifacts, prevent restarts on the all but the final deployment by setting `restart=false`. | No | Boolean |
358
359
|`clean`|`true`\|`false`| Specifies whether to clean (delete) the target deployment before deploying the artifact there. | No | Boolean |
359
360
|`ignorestack`|`true`\|`false`| The publish API uses the `WEBSITE_STACK` environment variable to choose safe defaults depending on your site's language stack. Setting this parameter to `false` disables any language-specific defaults. | No | Boolean |
360
361
|`target-path`| An absolute path | The absolute path to deploy the artifact to. For example, `"/home/site/deployments/tools/driver.jar"`, `"/home/site/scripts/helper.sh"`. | No | String |
361
362
362
-
## Next steps
363
+
## Related content
363
364
364
365
For more advanced deployment scenarios, try [deploying to Azure with Git](deploy-local-git.md). Git-based deployment to Azure enables version control, package restore, MSBuild, and more.
365
366
366
-
## More resources
367
-
368
-
*[Kudu: Deploying from a zip file](https://github.com/projectkudu/kudu/wiki/Deploying-from-a-zip-file)
369
-
*[Environment variables and app settings reference](reference-app-settings.md)
367
+
-[Kudu: Deploying from a zip file](https://github.com/projectkudu/kudu/wiki/Deploying-from-a-zip-file)
368
+
-[Environment variables and app settings reference](reference-app-settings.md)
0 commit comments