Azure Web App task

Azure Pipelines

Use this task to deploy web applications to Azure App service.

Arguments

ParametersDescription
azureSubscription
Azure subscription
(Required) Name of the Azure Resource Manager service connection
appType
App type
(Optional) Web App type
appName
App name
(Required) Name of an existing App Service
deployToSlotOrASE
Deploy to Slot or App Service Environment
(Optional) Select the option to deploy to an existing deployment slot or Azure App Service Environment. For both the targets, the task needs resource group name. In case the deployment target is a slot, by default the deployment is done to the production slot. Any other existing slot name can also be provided. In case the deployment target is an Azure App Service environment, specify the resource group name.
Default value: false
resourceGroupName
Resource group
(Required if deployToSlotOrASE is true) Name of the resource group
slotName
Slot
(Required if deployToSlotOrASE == true) Name of the slot
Default value: production
package
Package or folder
(Required) File path to the package or a folder containing app service contents generated by MSBuild war file or jar file. Variables ( Build | Release), wildcards are supported. For example, $(System.DefaultWorkingDirectory)//.zip or $(System.DefaultWorkingDirectory)//.war
runtimeStack
Runtime stack
(Optional) Web App on Linux offers two different options to publish your application, one is custom image deployment (Web App for Containers) and the other is app deployment with a built-in platform image (Web App on Linux). You will see this parameter only when you select Linux Web App in the app type selection option in the task. [Here](supports a number of Built-in images) is the list of Built-in images support
startUpCommand
Startup command
(Optional; Relevant if appType == webAppLinux) Startup command to be run post deployment
customWebConfig
Generate web.config parameters for Python, Node.js, Go and Java apps
(Optional) A standard web.config will be generated and deployed to Azure App Service if the application does not have one. The values in web.config can be edited and vary based on the application framework. For example for node.js application, web.config will have startup file and iis_node module values. This edit feature is only for the generated web.config. Learn more
appSettings
App settings
(Optional) Application settings to be entered using the syntax '-key value'. Values containing spaces should be enclosed in double quotes.
Example: -Port 5000 -RequestTimeout 5000 -WEBSITE_TIME_ZONE "Eastern Standard Time"
configurationStrings
Configuration settings
(Optional) Configuration strings to be entered using the syntax '-key value'. Values containing spaces should be enclosed in double quotes.
Example: -phpVersion 5.6 -linuxFxVersion: node|6.11
deploymentMethod
Deployment method
(Required) Deployment method for the app. Acceptable values: auto/zipDeploy/runFromPackage
Default value: auto

Following is an example YAML snippet to deploy web application to the Azure Web App service running on windows.

Example


variables:
  azureSubscription: Contoso
  # To ignore SSL error uncomment the below variable
  # VSTS_ARM_REST_IGNORE_SSL_ERRORS: true

steps:

- task: AzureWebApp@1
  displayName: Azure Web App Deploy
  inputs:
    azureSubscription: $(azureSubscription)
    appName: samplewebapp
    package: $(System.DefaultWorkingDirectory)/**/*.zip

To deploy Web App for linux, set the appType parameter to appType: webAppLinux.

To specify the deployment method as Zip Deploy, add the parameter deploymentMethod: zipDeploy. Other supported value for this parameter is runFromPackage. If not mentioned, auto is taken as the default value.

Deployment methods

Several deployment methods are available in this task. Auto is the default option.

To change the deployment option in designer task, expand Additional Deployment Options and enable Select deployment method to choose from additional package-based deployment options.

Based on the type of Azure App Service and Azure Pipelines agent, the task chooses a suitable deployment technology. The different deployment technologies used by the task are:

  • Kudu REST APIs
  • Zip Deploy
  • RunFromPackage

By default the task tries to select the appropriate deployment technology given the input package, app service type and agent OS.

  • When the App Service type is Web App on Linux App, use Zip Deploy
  • If War file is provided, use War Deploy
  • If Jar file is provided, use Run From package
  • For all others, use Run From Zip (via Zip Deploy)

On non-Windows agent (for any App service type), the task relies on Kudu REST APIs to deploy the Web App.

Kudu REST APIs

Works on Windows as well as Linux automation agent when the target is Web App on Windows or Web App on Linux (built-in source) or Function App. The task uses Kudu to copy files to the Azure App service.

Zip Deploy

Creates a .zip deployment package of the chosen Package or folder and deploys the file contents to the wwwroot folder of the App Service name function app in Azure. This option overwrites all existing contents in the wwwroot folder. For more information, see Zip deployment for Azure Functions.

RunFromPackage

Creates the same deployment package as Zip Deploy. However, instead of deploying files to the wwwroot folder, the entire package is mounted by the Functions runtime. With this option, files in the wwwroot folder become read-only. For more information, see Run your Azure Functions from a package file.

Open Source

This task is open source on GitHub. Feedback and contributions are welcome.