Skip to content

Commit 646230f

Browse files
authored
Merge pull request #293343 from TimShererWithAquent/us345675-05
Freshness Edit: Azure App Service (5 of several)
2 parents d50696a + df402f6 commit 646230f

File tree

2 files changed

+50
-52
lines changed

2 files changed

+50
-52
lines changed

articles/app-service/deploy-zip.md

Lines changed: 42 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
---
22
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.
44
ms.topic: article
5-
ms.date: 01/26/2024
5+
ms.date: 01/24/2025
66
ms.custom: devx-track-azurecli
77
author: cephalin
88
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.
910
---
1011

1112
# Deploy files to App Service
@@ -24,54 +25,54 @@ To complete the steps in this article, [create an App Service app](./index.yml),
2425

2526
## Deploy a ZIP package
2627

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.
2829

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:
3031

3132
- Deletion of files left over from a previous deployment.
3233
- Option to turn on the default build process, which includes package restore.
3334
- 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.
3637

3738
> [!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.
3940
40-
#### With zip deploy UI in Kudu
41+
### With zip deploy UI in Kudu
4142

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).
4344

4445
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.
4546

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*.
4748

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.
4950

50-
#### Without zip deploy UI in Kudu
51+
### Without zip deploy UI in Kudu
5152

5253
# [Azure CLI](#tab/cli)
5354

5455
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.
5556

5657
The following example pushes a ZIP package to your site. Specify the path to your local ZIP package for `--src-path`.
5758

58-
```azurecli-interactive
59+
```azurecli
5960
az webapp deploy --resource-group <group-name> --name <app-name> --src-path <zip-package-path>
6061
```
6162

62-
This command restarts the app after deploying the ZIP package.
63+
This command restarts the app after deploying the ZIP package.
6364

6465
# [Azure PowerShell](#tab/powershell)
6566

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>*
6768

68-
```azurepowershell-interactive
69+
```azurepowershell
6970
Publish-AzWebApp -ResourceGroupName Default-Web-WestUS -Name MyApp -ArchivePath <zip-package-path>
7071
```
7172

7273
# [Kudu API](#tab/api)
7374

74-
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>*.
7576

7677
```bash
7778
# Microsoft Entra authentication
@@ -90,7 +91,7 @@ curl -X POST \
9091
```
9192

9293
> [!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).
9495
9596
# [ARM template](#tab/arm)
9697

@@ -102,7 +103,7 @@ ARM templates only support [deployments from remotely hosted packages](#deploy-t
102103

103104
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):
104105

105-
```azurecli-interactive
106+
```azurecli
106107
az webapp config appsettings set --resource-group <group-name> --name <app-name> --settings SCM_DO_BUILD_DURING_DEPLOYMENT=true
107108
```
108109

@@ -112,29 +113,29 @@ For more information, see [Kudu documentation](https://github.com/projectkudu/ku
112113

113114
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.
114115

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.
116117

117118
# [Azure CLI](#tab/cli)
118119

119120
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`.
120121

121-
```azurecli-interactive
122+
```azurecli
122123
az webapp deploy --resource-group <group-name> --name <app-name> --src-path ./<package-name>.war
123124
```
124125

125126
The CLI command uses the [Kudu publish API](#kudu-publish-api-reference) to deploy the package and can be fully customized.
126127

127128
# [Azure PowerShell](#tab/powershell)
128129

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.
130131

131132
```powershell
132133
Publish-AzWebapp -ResourceGroupName <group-name> -Name <app-name> -ArchivePath <package-path>
133134
```
134135

135136
# [Kudu API](#tab/api)
136137

137-
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>*.
138139

139140
```bash
140141
# Microsoft Entra authentication
@@ -153,9 +154,9 @@ curl -X POST \
153154
```
154155

155156
> [!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).
157158
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).
159160

160161
# [ARM template](#tab/arm)
161162

@@ -171,7 +172,7 @@ Deploy a startup script, library, and static file to your web app by using the [
171172

172173
If you deploy a startup script this way, App Service automatically uses your script to start your app.
173174

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.
175176

176177
### Deploy a startup script
177178

@@ -199,7 +200,7 @@ Not supported. See Azure CLI or Kudu API.
199200

200201
### Deploy a startup script
201202

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>*.
203204

204205
```bash
205206
# Microsoft Entra authentication
@@ -218,11 +219,11 @@ curl -X POST \
218219
```
219220

220221
> [!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).
222223
223224
### Deploy a library file
224225

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>*.
226227

227228
```bash
228229
# Microsoft Entra authentication
@@ -241,11 +242,11 @@ curl -X POST \
241242
```
242243

243244
> [!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).
245246
246247
### Deploy a static file
247248

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>*.
249250

250251
```bash
251252
# Microsoft Entra authentication
@@ -264,7 +265,7 @@ curl -X POST \
264265
```
265266

266267
> [!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).
268269
269270
# [ARM template](#tab/arm)
270271

@@ -282,7 +283,7 @@ The remote URL can be any publicly accessible location, but it's best to use a b
282283

283284
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.
284285

285-
```azurecli-interactive
286+
```azurecli
286287
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
287288
```
288289

@@ -292,7 +293,7 @@ Not supported. See Azure CLI, Kudu API, or ARM template.
292293

293294
# [Kudu API](#tab/api)
294295

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>*.
296297

297298
```bash
298299
# Microsoft Entra authentication
@@ -313,11 +314,11 @@ curl -X POST \
313314
```
314315

315316
> [!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).
317318
318319
# [ARM template](#tab/arm)
319320

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>*.
321322

322323
```json
323324
{
@@ -347,23 +348,21 @@ Use the following reference to help you configure the properties:
347348

348349
## Kudu publish API reference
349350

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).
351352

352353
The following table shows the available query parameters, their allowed values, and descriptions.
353354

354355
| Key | Allowed values | Description | Required | Type |
355356
|-|-|-|-|-|
356-
| `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 |
357358
| `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 |
358359
| `clean` | `true`\|`false` | Specifies whether to clean (delete) the target deployment before deploying the artifact there. | No | Boolean |
359360
| `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 |
360361
| `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 |
361362

362-
## Next steps
363+
## Related content
363364

364365
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.
365366

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

Comments
 (0)