AzureRmWebAppDeployment@4 - Azure App Service deploy v4 task

Use this task to deploy to Azure App Service a web, mobile, or API app using Docker, Java, .NET, .NET Core, Node.js, PHP, Python, or Ruby.

Update Azure App Services on Windows, Web App on Linux with built-in images or Docker containers, ASP.NET, .NET Core, PHP, Python or Node.js based Web applications, Function Apps on Windows or Linux with Docker Containers, Mobile Apps, API applications, and Web Jobs using Web Deploy/Kudu REST APIs.

Syntax

# Azure App Service deploy v4
# Deploy to Azure App Service a web, mobile, or API app using Docker, Java, .NET, .NET Core, Node.js, PHP, Python, or Ruby.
- task: AzureRmWebAppDeployment@4
  inputs:
    ConnectionType: 'AzureRM' # 'AzureRM' | 'PublishProfile'. Required. Connection type. Default: AzureRM.
    azureSubscription: # string. Alias: ConnectedServiceName. Required when ConnectionType = AzureRM. Azure subscription. 
    #PublishProfilePath: '$(System.DefaultWorkingDirectory)/**/*.pubxml' # string. Required when ConnectionType = PublishProfile. Publish profile path. Default: $(System.DefaultWorkingDirectory)/**/*.pubxml.
    #PublishProfilePassword: # string. Required when ConnectionType = PublishProfile. Publish profile password. 
    appType: 'webApp' # 'webApp' | 'webAppLinux' | 'webAppContainer' | 'webAppHyperVContainer' | 'functionApp' | 'functionAppLinux' | 'functionAppContainer' | 'apiApp' | 'mobileApp'. Alias: WebAppKind. Required when ConnectionType = AzureRM. App Service type. Default: webApp.
    WebAppName: # string. Required when ConnectionType = AzureRM. App Service name. 
    #deployToSlotOrASE: false # boolean. Alias: DeployToSlotOrASEFlag. Optional. Use when ConnectionType = AzureRM && WebAppKind != "". Deploy to Slot or App Service Environment. Default: false.
    #ResourceGroupName: # string. Required when DeployToSlotOrASEFlag = true. Resource group. 
    #SlotName: 'production' # string. Required when DeployToSlotOrASEFlag = true. Slot. Default: production.
    #DockerNamespace: # string. Required when WebAppKind = webAppContainer || WebAppkind = functionAppContainer || WebAppkind = webAppHyperVContainer. Registry or Namespace. 
    #DockerRepository: # string. Required when WebAppKind = webAppContainer || WebAppkind = functionAppContainer || WebAppkind = webAppHyperVContainer. Image. 
    #DockerImageTag: # string. Optional. Use when WebAppKind = webAppContainer || WebAppkind = functionAppContainer || WebAppkind = webAppHyperVContainer. Tag. 
    #VirtualApplication: # string. Optional. Use when WebAppKind != webAppLinux && WebAppKind != webAppContainer && WebAppkind != functionAppContainer && WebAppKind != functionApp && webAppKind != functionAppLinux && WebAppKind != "". Virtual application. 
    #packageForLinux: '$(System.DefaultWorkingDirectory)/**/*.zip' # string. Alias: Package. Required when ConnectionType = PublishProfile || WebAppKind = webApp || WebAppKind = apiApp || WebAppKind = functionApp || WebAppKind = mobileApp || WebAppKind = webAppLinux || webAppKind = functionAppLinux. Package or folder. Default: $(System.DefaultWorkingDirectory)/**/*.zip.
    #RuntimeStack: # string. Optional. Use when WebAppKind = webAppLinux. Runtime Stack. 
    #RuntimeStackFunction: # 'DOTNET|2.2' | 'DOTNET|3.1' | 'JAVA|8' | 'JAVA|11' | 'NODE|8' | 'NODE|10' | 'NODE|12' | 'NODE|14' | 'PYTHON|3.6' | 'PYTHON|3.7' | 'PYTHON|3.8'. Optional. Use when WebAppKind = functionAppLinux. Runtime Stack. 
    #StartupCommand: # string. Optional. Use when WebAppKind = webAppLinux || WebAppKind = webAppContainer || WebAppkind = functionAppContainer || WebAppKind = functionAppLinux || WebAppkind = webAppHyperVContainer. Startup command. 
  # Post Deployment Action
    #ScriptType: # 'Inline Script' | 'File Path'. Deployment script type. 
    #InlineScript: ':: You can provide your deployment commands here. One command per line.' # string. Required when ScriptType == Inline Script. Inline Script. Default: :: You can provide your deployment commands here. One command per line..
    #ScriptPath: # string. Required when ScriptType == File Path. Deployment script path. 
  # File Transforms & Variable Substitution Options
    #WebConfigParameters: # string. Generate web.config parameters for Python, Node.js, Go and Java apps. 
    #enableXmlTransform: false # boolean. Alias: XmlTransformation. XML transformation. Default: false.
    #enableXmlVariableSubstitution: false # boolean. Alias: XmlVariableSubstitution. XML variable substitution. Default: false.
    #JSONFiles: # string. JSON variable substitution. 
  # Application and Configuration Settings
    #AppSettings: # string. App settings. 
    #ConfigurationSettings: # string. Configuration settings. 
  # Additional Deployment Options
    #enableCustomDeployment: false # boolean. Alias: UseWebDeploy. Select deployment method. Default: false.
    #DeploymentType: 'webDeploy' # 'webDeploy' | 'zipDeploy' | 'runFromZip'. Required when UseWebDeploy == true. Deployment method. Default: webDeploy.
    #TakeAppOfflineFlag: true # boolean. Optional. Use when UseWebDeploy == true && DeploymentType != runFromZip. Take App Offline. Default: true.
    #SetParametersFile: # string. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy. SetParameters file. 
    #RemoveAdditionalFilesFlag: false # boolean. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy. Remove additional files at destination. Default: false.
    #ExcludeFilesFromAppDataFlag: true # boolean. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy. Exclude files from the App_Data folder. Default: true.
    #AdditionalArguments: '-retryAttempts:6 -retryInterval:10000' # string. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy. Additional arguments. Default: -retryAttempts:6 -retryInterval:10000.
    #RenameFilesFlag: true # boolean. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy. Rename locked files. Default: true.
# Azure App Service deploy v4
# Deploy to Azure App Service a web, mobile, or API app using Docker, Java, .NET, .NET Core, Node.js, PHP, Python, or Ruby.
- task: AzureRmWebAppDeployment@4
  inputs:
    ConnectionType: 'AzureRM' # 'AzureRM' | 'PublishProfile'. Required. Connection type. Default: AzureRM.
    azureSubscription: # string. Alias: ConnectedServiceName. Required when ConnectionType = AzureRM. Azure subscription. 
    #PublishProfilePath: '$(System.DefaultWorkingDirectory)/**/*.pubxml' # string. Required when ConnectionType = PublishProfile. Publish profile path. Default: $(System.DefaultWorkingDirectory)/**/*.pubxml.
    #PublishProfilePassword: # string. Required when ConnectionType = PublishProfile. Publish profile password. 
    appType: 'webApp' # 'webApp' | 'webAppLinux' | 'webAppContainer' | 'functionApp' | 'functionAppLinux' | 'functionAppContainer' | 'apiApp' | 'mobileApp'. Alias: WebAppKind. Required when ConnectionType = AzureRM. App Service type. Default: webApp.
    WebAppName: # string. Required when ConnectionType = AzureRM. App Service name. 
    #deployToSlotOrASE: false # boolean. Alias: DeployToSlotOrASEFlag. Optional. Use when ConnectionType = AzureRM && WebAppKind != "". Deploy to Slot or App Service Environment. Default: false.
    #ResourceGroupName: # string. Required when DeployToSlotOrASEFlag = true. Resource group. 
    #SlotName: 'production' # string. Required when DeployToSlotOrASEFlag = true. Slot. Default: production.
    #DockerNamespace: # string. Required when WebAppKind = webAppContainer || WebAppkind = functionAppContainer. Registry or Namespace. 
    #DockerRepository: # string. Required when WebAppKind = webAppContainer || WebAppkind = functionAppContainer. Image. 
    #DockerImageTag: # string. Optional. Use when WebAppKind = webAppContainer || WebAppkind = functionAppContainer. Tag. 
    #VirtualApplication: # string. Optional. Use when WebAppKind != webAppLinux && WebAppKind != webAppContainer && WebAppkind != functionAppContainer && WebAppKind != functionApp && webAppKind != functionAppLinux && WebAppKind != "". Virtual application. 
    #packageForLinux: '$(System.DefaultWorkingDirectory)/**/*.zip' # string. Alias: Package. Required when ConnectionType = PublishProfile || WebAppKind = webApp || WebAppKind = apiApp || WebAppKind = functionApp || WebAppKind = mobileApp || WebAppKind = webAppLinux || webAppKind = functionAppLinux. Package or folder. Default: $(System.DefaultWorkingDirectory)/**/*.zip.
    #RuntimeStack: # string. Optional. Use when WebAppKind = webAppLinux. Runtime Stack. 
    #RuntimeStackFunction: # 'DOTNET|2.2' | 'DOTNET|3.1' | 'JAVA|8' | 'JAVA|11' | 'NODE|8' | 'NODE|10' | 'NODE|12' | 'NODE|14' | 'PYTHON|3.6' | 'PYTHON|3.7' | 'PYTHON|3.8'. Optional. Use when WebAppKind = functionAppLinux. Runtime Stack. 
    #StartupCommand: # string. Optional. Use when WebAppKind = webAppLinux || WebAppKind = webAppContainer || WebAppkind = functionAppContainer || WebAppKind = functionAppLinux. Startup command. 
  # Post Deployment Action
    #ScriptType: # 'Inline Script' | 'File Path'. Deployment script type. 
    #InlineScript: ':: You can provide your deployment commands here. One command per line.' # string. Required when ScriptType == Inline Script. Inline Script. Default: :: You can provide your deployment commands here. One command per line..
    #ScriptPath: # string. Required when ScriptType == File Path. Deployment script path. 
  # File Transforms & Variable Substitution Options
    #WebConfigParameters: # string. Generate web.config parameters for Python, Node.js, Go and Java apps. 
    #enableXmlTransform: false # boolean. Alias: XmlTransformation. XML transformation. Default: false.
    #enableXmlVariableSubstitution: false # boolean. Alias: XmlVariableSubstitution. XML variable substitution. Default: false.
    #JSONFiles: # string. JSON variable substitution. 
  # Application and Configuration Settings
    #AppSettings: # string. App settings. 
    #ConfigurationSettings: # string. Configuration settings. 
  # Additional Deployment Options
    #enableCustomDeployment: false # boolean. Alias: UseWebDeploy. Select deployment method. Default: false.
    #DeploymentType: 'webDeploy' # 'webDeploy' | 'zipDeploy' | 'runFromZip'. Required when UseWebDeploy == true. Deployment method. Default: webDeploy.
    #TakeAppOfflineFlag: true # boolean. Optional. Use when UseWebDeploy == true && DeploymentType != runFromZip. Take App Offline. Default: true.
    #SetParametersFile: # string. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy. SetParameters file. 
    #RemoveAdditionalFilesFlag: false # boolean. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy. Remove additional files at destination. Default: false.
    #ExcludeFilesFromAppDataFlag: true # boolean. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy. Exclude files from the App_Data folder. Default: true.
    #AdditionalArguments: '-retryAttempts:6 -retryInterval:10000' # string. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy. Additional arguments. Default: -retryAttempts:6 -retryInterval:10000.
    #RenameFilesFlag: true # boolean. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy. Rename locked files. Default: true.
# Azure App Service deploy v4
# Deploy to Azure App Service a web, mobile, or API app using Docker, Java, .NET, .NET Core, Node.js, PHP, Python, or Ruby.
- task: AzureRmWebAppDeployment@4
  inputs:
    ConnectionType: 'AzureRM' # 'AzureRM' | 'PublishProfile'. Required. Connection type. Default: AzureRM.
    azureSubscription: # string. Alias: ConnectedServiceName. Required when ConnectionType = AzureRM. Azure subscription. 
    #PublishProfilePath: '$(System.DefaultWorkingDirectory)/**/*.pubxml' # string. Required when ConnectionType = PublishProfile. Publish profile path. Default: $(System.DefaultWorkingDirectory)/**/*.pubxml.
    #PublishProfilePassword: # string. Required when ConnectionType = PublishProfile. Publish profile password. 
    appType: 'webApp' # 'webApp' | 'webAppLinux' | 'webAppContainer' | 'functionApp' | 'functionAppLinux' | 'functionAppContainer' | 'apiApp' | 'mobileApp'. Alias: WebAppKind. Required when ConnectionType = AzureRM. App Service type. Default: webApp.
    WebAppName: # string. Required when ConnectionType = AzureRM. App Service name. 
    #deployToSlotOrASE: false # boolean. Alias: DeployToSlotOrASEFlag. Optional. Use when ConnectionType = AzureRM && WebAppKind != "". Deploy to Slot or App Service Environment. Default: false.
    #ResourceGroupName: # string. Required when DeployToSlotOrASEFlag = true. Resource group. 
    #SlotName: 'production' # string. Required when DeployToSlotOrASEFlag = true. Slot. Default: production.
    #DockerNamespace: # string. Required when WebAppKind = webAppContainer || WebAppkind = functionAppContainer. Registry or Namespace. 
    #DockerRepository: # string. Required when WebAppKind = webAppContainer || WebAppkind = functionAppContainer. Image. 
    #DockerImageTag: # string. Optional. Use when WebAppKind = webAppContainer || WebAppkind = functionAppContainer. Tag. 
    #VirtualApplication: # string. Optional. Use when WebAppKind != webAppLinux && WebAppKind != webAppContainer && WebAppkind != functionAppContainer && WebAppKind != functionApp && webAppKind != functionAppLinux && WebAppKind != "". Virtual application. 
    #packageForLinux: '$(System.DefaultWorkingDirectory)/**/*.zip' # string. Alias: Package. Required when ConnectionType = PublishProfile || WebAppKind = webApp || WebAppKind = apiApp || WebAppKind = functionApp || WebAppKind = mobileApp || WebAppKind = webAppLinux || webAppKind = functionAppLinux. Package or folder. Default: $(System.DefaultWorkingDirectory)/**/*.zip.
    #RuntimeStack: # string. Optional. Use when WebAppKind = webAppLinux. Runtime Stack. 
    #RuntimeStackFunction: # 'DOCKER|microsoft/azure-functions-dotnet-core2.0:2.0' | 'DOCKER|microsoft/azure-functions-node8:2.0'. Optional. Use when WebAppKind = functionAppLinux. Runtime Stack. 
    #StartupCommand: # string. Optional. Use when WebAppKind = webAppLinux || WebAppKind = webAppContainer || WebAppkind = functionAppContainer || WebAppKind = functionAppLinux. Startup command. 
  # Post Deployment Action
    #ScriptType: # 'Inline Script' | 'File Path'. Deployment script type. 
    #InlineScript: ':: You can provide your deployment commands here. One command per line.' # string. Required when ScriptType == Inline Script. Inline Script. Default: :: You can provide your deployment commands here. One command per line..
    #ScriptPath: # string. Required when ScriptType == File Path. Deployment script path. 
  # File Transforms & Variable Substitution Options
    #WebConfigParameters: # string. Generate web.config parameters for Python, Node.js, Go and Java apps. 
    #enableXmlTransform: false # boolean. Alias: XmlTransformation. XML transformation. Default: false.
    #enableXmlVariableSubstitution: false # boolean. Alias: XmlVariableSubstitution. XML variable substitution. Default: false.
    #JSONFiles: # string. JSON variable substitution. 
  # Application and Configuration Settings
    #AppSettings: # string. App settings. 
    #ConfigurationSettings: # string. Configuration settings. 
  # Additional Deployment Options
    #enableCustomDeployment: false # boolean. Alias: UseWebDeploy. Select deployment method. Default: false.
    #DeploymentType: 'webDeploy' # 'webDeploy' | 'zipDeploy' | 'runFromZip'. Required when UseWebDeploy == true. Deployment method. Default: webDeploy.
    #TakeAppOfflineFlag: true # boolean. Optional. Use when UseWebDeploy == true && DeploymentType != runFromZip. Take App Offline. Default: true.
    #SetParametersFile: # string. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy. SetParameters file. 
    #RemoveAdditionalFilesFlag: false # boolean. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy. Remove additional files at destination. Default: false.
    #ExcludeFilesFromAppDataFlag: true # boolean. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy. Exclude files from the App_Data folder. Default: true.
    #AdditionalArguments: '-retryAttempts:6 -retryInterval:10000' # string. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy. Additional arguments. Default: -retryAttempts:6 -retryInterval:10000.
    #RenameFilesFlag: true # boolean. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy. Rename locked files. Default: true.
# Azure App Service Deploy v4
# Update Azure App Services on Windows, Web App on Linux with built-in images or Docker containers, ASP.NET, .NET Core, PHP, Python or Node.js based Web applications, Function Apps on Windows or Linux with Docker Containers, Mobile Apps, API applications, Web Jobs using Web Deploy / Kudu REST APIs.
- task: AzureRmWebAppDeployment@4
  inputs:
    ConnectionType: 'AzureRM' # 'AzureRM' | 'PublishProfile'. Required. Connection type. Default: AzureRM.
    azureSubscription: # string. Alias: ConnectedServiceName. Required when ConnectionType = AzureRM. Azure subscription. 
    #PublishProfilePath: '$(System.DefaultWorkingDirectory)/**/*.pubxml' # string. Required when ConnectionType = PublishProfile. Publish profile path. Default: $(System.DefaultWorkingDirectory)/**/*.pubxml.
    #PublishProfilePassword: # string. Required when ConnectionType = PublishProfile. Publish profile password. 
    appType: 'webApp' # 'webApp' | 'webAppLinux' | 'webAppContainer' | 'functionApp' | 'functionAppLinux' | 'functionAppContainer' | 'apiApp' | 'mobileApp'. Alias: WebAppKind. Required when ConnectionType = AzureRM. App Service type. Default: webApp.
    WebAppName: # string. Required when ConnectionType = AzureRM. App Service name. 
    #deployToSlotOrASE: false # boolean. Alias: DeployToSlotOrASEFlag. Optional. Use when ConnectionType = AzureRM && WebAppKind != "". Deploy to Slot or App Service Environment. Default: false.
    #ResourceGroupName: # string. Required when DeployToSlotOrASEFlag = true. Resource group. 
    #SlotName: 'production' # string. Required when DeployToSlotOrASEFlag = true. Slot. Default: production.
    #DockerNamespace: # string. Required when WebAppKind = webAppContainer || WebAppkind = functionAppContainer. Registry or Namespace. 
    #DockerRepository: # string. Required when WebAppKind = webAppContainer || WebAppkind = functionAppContainer. Image. 
    #DockerImageTag: # string. Optional. Use when WebAppKind = webAppContainer || WebAppkind = functionAppContainer. Tag. 
    #VirtualApplication: # string. Optional. Use when WebAppKind != webAppLinux && WebAppKind != webAppContainer && WebAppkind != functionAppContainer && WebAppKind != functionApp && webAppKind != functionAppLinux && WebAppKind != "". Virtual application. 
    #packageForLinux: '$(System.DefaultWorkingDirectory)/**/*.zip' # string. Alias: Package. Required when ConnectionType = PublishProfile || WebAppKind = webApp || WebAppKind = apiApp || WebAppKind = functionApp || WebAppKind = mobileApp || WebAppKind = webAppLinux || webAppKind = functionAppLinux. Package or folder. Default: $(System.DefaultWorkingDirectory)/**/*.zip.
    #RuntimeStack: # string. Optional. Use when WebAppKind = webAppLinux. Runtime Stack. 
    #RuntimeStackFunction: # 'DOCKER|microsoft/azure-functions-dotnet-core2.0:2.0' | 'DOCKER|microsoft/azure-functions-node8:2.0'. Optional. Use when WebAppKind = functionAppLinux. Runtime Stack. 
    #StartupCommand: # string. Optional. Use when WebAppKind = webAppLinux || WebAppKind = webAppContainer || WebAppkind = functionAppContainer. Startup command. 
  # Post Deployment Action
    #ScriptType: # 'Inline Script' | 'File Path'. Deployment script type. 
    #InlineScript: ':: You can provide your deployment commands here. One command per line.' # string. Required when ScriptType == Inline Script. Inline Script. Default: :: You can provide your deployment commands here. One command per line..
    #ScriptPath: # string. Required when ScriptType == File Path. Deployment script path. 
  # File Transforms & Variable Substitution Options
    #WebConfigParameters: # string. Generate web.config parameters for Python, Node.js, Go and Java apps. 
    #enableXmlTransform: false # boolean. Alias: XmlTransformation. XML transformation. Default: false.
    #enableXmlVariableSubstitution: false # boolean. Alias: XmlVariableSubstitution. XML variable substitution. Default: false.
    #JSONFiles: # string. JSON variable substitution. 
  # Application and Configuration Settings
    #AppSettings: # string. App settings. 
    #ConfigurationSettings: # string. Configuration settings. 
  # Additional Deployment Options
    #enableCustomDeployment: false # boolean. Alias: UseWebDeploy. Select deployment method. Default: false.
    #DeploymentType: 'webDeploy' # 'webDeploy' | 'zipDeploy' | 'runFromZip'. Required when UseWebDeploy == true. Deployment method. Default: webDeploy.
    #TakeAppOfflineFlag: true # boolean. Optional. Use when UseWebDeploy == true && DeploymentType != runFromZip. Take App Offline. Default: true.
    #SetParametersFile: # string. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy. SetParameters file. 
    #RemoveAdditionalFilesFlag: false # boolean. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy. Remove additional files at destination. Default: false.
    #ExcludeFilesFromAppDataFlag: true # boolean. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy. Exclude files from the App_Data folder. Default: true.
    #AdditionalArguments: '-retryAttempts:6 -retryInterval:10000' # string. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy. Additional arguments. Default: -retryAttempts:6 -retryInterval:10000.
    #RenameFilesFlag: true # boolean. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy. Rename locked files. Default: true.

Inputs

ConnectionType - Connection type
string. Required. Allowed values: AzureRM (Azure Resource Manager), PublishProfile (Publish Profile). Default value: AzureRM.

Specify the service connection type to use to deploy the Web App.

Specify Publish Profile for using Visual Studio created Publish profiles.


ConnectionType - Connection type
string. Required. Allowed values: AzureRM (Azure Resource Manager), PublishProfile (Publish Profile). Default value: AzureRM.

Specify the service connection type to use to deploy the Web App.


azureSubscription - Azure subscription
Input alias: ConnectedServiceName. string. Required when ConnectionType = AzureRM.

Specify the Azure Resource Manager subscription for the deployment.


PublishProfilePath - Publish profile path
string. Required when ConnectionType = PublishProfile. Default value: $(System.DefaultWorkingDirectory)/**/*.pubxml.

The path of the publish profile created from Visual Studio.


PublishProfilePassword - Publish profile password
string. Required when ConnectionType = PublishProfile.

It is recommended to store a password in a secret variable and use that variable here e.g. $(Password).


appType - App Service type
Input alias: WebAppKind. string. Required when ConnectionType = AzureRM. Allowed values: webApp (Web App on Windows), webAppLinux (Web App on Linux), webAppContainer (Web App for Containers (Linux)), webAppHyperVContainer (Web App for Containers (Windows)), functionApp (Function App on Windows), functionAppLinux (Function App on Linux), functionAppContainer (Function App for Containers (Linux)), apiApp (API App), mobileApp (Mobile App). Default value: webApp.

Choose from Web App On Windows, Web App On Linux, Web App for Containers, Function App, Function App on Linux, Function App for Containers and Mobile App.


appType - App Service type
Input alias: WebAppKind. string. Required when ConnectionType = AzureRM. Allowed values: webApp (Web App on Windows), webAppLinux (Web App on Linux), webAppContainer (Web App for Containers (Linux)), functionApp (Function App on Windows), functionAppLinux (Function App on Linux), functionAppContainer (Function App for Containers (Linux)), apiApp (API App), mobileApp (Mobile App). Default value: webApp.

Choose from Web App On Windows, Web App On Linux, Web App for Containers, Function App, Function App on Linux, Function App for Containers and Mobile App.


WebAppName - App Service name
string. Required when ConnectionType = AzureRM.

Specify the name of an existing Azure App Service. App services based on the selected app type will only be listed when using the task assistant.


deployToSlotOrASE - Deploy to Slot or App Service Environment
Input alias: DeployToSlotOrASEFlag. boolean. Optional. Use when ConnectionType = AzureRM && WebAppKind != "". Default value: false.

Specify the option to deploy to an existing deployment slot or Azure App Service environment. For both targets, the task requires a Resource Group name. If the deployment target is a slot, by default the deployment is to the Production slot. Any other existing slot name can be provided. If the deployment target is an Azure App Service environment, leave the slot name as Production and specify just the Resource Group name.


ResourceGroupName - Resource group
string. Required when DeployToSlotOrASEFlag = true.

The Resource group name is required when the deployment target is either a deployment slot or an App Service Environment.

Specify the Azure Resource group that contains the Azure App Service specified above.


SlotName - Slot
string. Required when DeployToSlotOrASEFlag = true. Default value: production.

Specify an existing slot other than the Production slot.


DockerNamespace - Registry or Namespace
string. Required when WebAppKind = webAppContainer || WebAppkind = functionAppContainer || WebAppkind = webAppHyperVContainer.

A globally unique top-level domain name for your specific registry or namespace. Note: The fully qualified image name will be of the format: {registry or namespace}/{repository}:{tag}. For example, myregistry.azurecr.io/nginx:latest.


DockerNamespace - Registry or Namespace
string. Required when WebAppKind = webAppContainer || WebAppkind = functionAppContainer.

A globally unique top-level domain name for your specific registry or namespace. Note: The fully qualified image name will be of the format: {registry or namespace}/{repository}:{tag}. For example, myregistry.azurecr.io/nginx:latest.


DockerRepository - Image
string. Required when WebAppKind = webAppContainer || WebAppkind = functionAppContainer || WebAppkind = webAppHyperVContainer.

The name of the repository where the container images are stored. Note: The fully qualified image name will be of the format: {registry or namespace}/{repository}:{tag}. For example, myregistry.azurecr.io/nginx:latest.


DockerRepository - Image
string. Required when WebAppKind = webAppContainer || WebAppkind = functionAppContainer.

The name of the repository where the container images are stored. Note: The fully qualified image name will be of the format: {registry or namespace}/{repository}:{tag}. For example, myregistry.azurecr.io/nginx:latest.


DockerImageTag - Tag
string. Optional. Use when WebAppKind = webAppContainer || WebAppkind = functionAppContainer || WebAppkind = webAppHyperVContainer.

Tags are the mechanism that registries use to apply version information to Docker images. Note: The fully qualified image name will be of the format: {registry or namespace}/{repository}:{tag}. For example, myregistry.azurecr.io/nginx:latest.


DockerImageTag - Tag
string. Optional. Use when WebAppKind = webAppContainer || WebAppkind = functionAppContainer.

Tags are the mechanism that registries use to apply version information to Docker images. Note: The fully qualified image name will be of the format: {registry or namespace}/{repository}:{tag}. For example, myregistry.azurecr.io/nginx:latest.


VirtualApplication - Virtual application
string. Optional. Use when WebAppKind != webAppLinux && WebAppKind != webAppContainer && WebAppkind != functionAppContainer && WebAppKind != functionApp && webAppKind != functionAppLinux && WebAppKind != "".

Specify the name of the Virtual Application that has been configured in the Azure portal. This option is not required for deployments to the website root. The Virtual Application must have been configured before deployment of the web project.


packageForLinux - Package or folder
Input alias: Package. string. Required when ConnectionType = PublishProfile || WebAppKind = webApp || WebAppKind = apiApp || WebAppKind = functionApp || WebAppKind = mobileApp || WebAppKind = webAppLinux || webAppKind = functionAppLinux. Default value: $(System.DefaultWorkingDirectory)/**/*.zip.

The file path to the package, or to a folder containing app service contents generated by MSBuild or a compressed zip or war file.

Variables are Build and Release. Wildcards are supported.

For example, $(System.DefaultWorkingDirectory)/\*\*/\*.zip or $(System.DefaultWorkingDirectory)/\*\*/\*.war.


RuntimeStack - Runtime Stack
string. Optional. Use when WebAppKind = webAppLinux.

Specify the framework and version for Function App on Linux.


RuntimeStackFunction - Runtime Stack
string. Optional. Use when WebAppKind = functionAppLinux. Allowed values: DOTNET|2.2 (DOTNET|2.2 (functionapp v2)), DOTNET|3.1 (DOTNET|3.1 (functionapp v3)), JAVA|8 (JAVA|8 (functionapp v2/v3)), JAVA|11 (JAVA|11 (functionapp v3)), NODE|8 (NODE|8 (functionapp v2)), NODE|10 (NODE|10 (functionapp v2/v3)), NODE|12 (NODE|12 (functionapp v3)), NODE|14 (NODE|14 (functionapp v3)), PYTHON|3.6 (PYTHON|3.6 (functionapp v2/v3)), PYTHON|3.7 (PYTHON|3.7 (functionapp v2/v3)), PYTHON|3.8 (PYTHON|3.8 (functionapp v3)).

Specify the framework and version. Refer to the Azure Functions runtime versions overview for supported runtime versions. Old values like DOCKER|microsoft/azure-functions-* are deprecated. Please use the new values from dropdown.


RuntimeStackFunction - Runtime Stack
string. Optional. Use when WebAppKind = functionAppLinux. Allowed values: DOCKER|microsoft/azure-functions-dotnet-core2.0:2.0 (.NET), DOCKER|microsoft/azure-functions-node8:2.0 (JavaScript).

Specify the framework and version.


StartupCommand - Startup command
string. Optional. Use when WebAppKind = webAppLinux || WebAppKind = webAppContainer || WebAppkind = functionAppContainer || WebAppKind = functionAppLinux || WebAppkind = webAppHyperVContainer.

Specify the Startup command. For example:

dotnet exec filename.dll

dotnet filename.dll.


StartupCommand - Startup command
string. Optional. Use when WebAppKind = webAppLinux || WebAppKind = webAppContainer || WebAppkind = functionAppContainer || WebAppKind = functionAppLinux.

Specify the Startup command. For example:

dotnet exec filename.dll

dotnet filename.dll.


StartupCommand - Startup command
string. Optional. Use when WebAppKind = webAppLinux || WebAppKind = webAppContainer || WebAppkind = functionAppContainer || WebAppKind = functionAppLinux.

Specify the Startup command. For example, dotnet run dotnet filename.dll.


StartupCommand - Startup command
string. Optional. Use when WebAppKind = webAppLinux || WebAppKind = webAppContainer || WebAppkind = functionAppContainer.

Specify the Startup command.


ScriptType - Deployment script type
string. Allowed values: Inline Script, File Path (Script File Path).

Customizes the deployment by providing a script that runs on the Azure App Service after successful deployment. Choose inline deployment script or the path and name of a script file. Learn more about Azure App Service Deployment.


InlineScript - Inline Script
string. Required when ScriptType == Inline Script. Default value: :: You can provide your deployment commands here. One command per line..

The script to execute. You can provide your deployment commands here, one command per line. See the following example.


ScriptPath - Deployment script path
string. Required when ScriptType == File Path.

The path and name of the script to execute.


WebConfigParameters - Generate web.config parameters for Python, Node.js, Go and Java apps
string.

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 applications, web.config will have a Startup file and iis_node module values. This edit feature is only for the generated web.config. Learn more about Azure App Service Deployment.


AppSettings - App settings
string.

Edits web app application settings using the syntax -key value. Values containing spaces must be enclosed in double quotes. Examples: -Port 5000 -RequestTimeout 5000 and -WEBSITE_TIME_ZONE "Eastern Standard Time". To provide two or more key values, the key values must be separated by a space. Example: -key1 "Value1" -Key2 "Value2".


ConfigurationSettings - Configuration settings
string.

Edits web app configuration settings using the syntax -key value. Values containing spaces must be enclosed in double quotes. Example: -phpVersion 5.6 -linuxFxVersion: node|6.11.


enableCustomDeployment - Select deployment method
Input alias: UseWebDeploy. boolean. Default value: false.

If unchecked or false, the task auto-detects the best deployment method based on the app type, package format, and other parameters. Check this option in the task assistant to view the supported deployment methods, and choose one for deploying your app.


DeploymentType - Deployment method
string. Required when UseWebDeploy == true. Allowed values: webDeploy (Web Deploy), zipDeploy (Zip Deploy), runFromZip (Run From Package). Default value: webDeploy.

Determines the deployment method for the app.


TakeAppOfflineFlag - Take App Offline
boolean. Optional. Use when UseWebDeploy == true && DeploymentType != runFromZip. Default value: true.

Specify this option to take the Azure App Service offline by placing an app_offline.htm file in the root directory before the synchronization operation begins. The file will be removed after the synchronization completes successfully.


SetParametersFile - SetParameters file
string. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy.

The location of the SetParameters.xml file to use.


RemoveAdditionalFilesFlag - Remove additional files at destination
boolean. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy. Default value: false.

Specify 'true' to delete files on the Azure App Service that have no matching files in the App Service package or folder. This will also remove all files related to any extension installed on this Azure App Service. To prevent this, select the Exclude files from App_Data folder checkbox.


ExcludeFilesFromAppDataFlag - Exclude files from the App_Data folder
boolean. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy. Default value: true.

Specify the option to prevent files in the App_Data folder from being deployed to/deleted from the Azure App Service.


AdditionalArguments - Additional arguments
string. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy. Default value: -retryAttempts:6 -retryInterval:10000.

Additional Web Deploy arguments following the syntax -key:value. These will be applied when deploying the Azure App Service. Examples: -disableLink:AppPoolExtension -disableLink:ContentExtension. Learn more about Web Deploy Operation Settings.


RenameFilesFlag - Rename locked files
boolean. Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy. Default value: true.

Specify the default value to enable the msdeploy flag MSDEPLOY_RENAME_LOCKED_FILES=1 in Azure App Service application settings. If set, the option enables msdeploy to rename files that are locked during app deployment.


enableXmlTransform - XML transformation
Input alias: XmlTransformation. boolean. Default value: false.

The config transforms will be run for *.Release.config and *.<EnvironmentName>.config on the *.config file. Configuration transformations run before variable substitution. XML transformations are supported only for the Windows platform.


enableXmlVariableSubstitution - XML variable substitution
Input alias: XmlVariableSubstitution. boolean. Default value: false.

Variables defined in the build or release pipeline will be matched against the key or name entries in the configSections, appSettings, applicationSettings, and connectionStrings sections of any configuration file and parameters.xml file. Variable substitution runs after configuration transformations.

If the same variables are defined in the release pipeline and in the stage, the stage variables will supersede the release pipeline variables. Learn more about [XML variable substitution]](/azure/devops/pipelines/tasks/transforms-variable-substitution#xml-variable-substitution).


JSONFiles - JSON variable substitution
string.

Provides a newline-separated list of JSON files to substitute the variable values. File names must be relative to the root folder. To substitute JSON variables that are nested or hierarchical, specify them using JSONPath expressions. For example, to replace the value of ConnectionString in the sample below, define a variable named Data.DefaultConnection.ConnectionString in the build or release pipeline (or release pipelines stage).

{
  "Data": {
    "DefaultConnection": {
      "ConnectionString": "Server=(localdb)\SQLEXPRESS;Database=MyDB;Trusted_Connection=True"
    }
  }
}

A variable substitution runs after configuration transformations. Note: Build and release pipeline variables are excluded from substitution. Learn more about JSON variable substitution.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

This task defines the following output variables, which you can consume in downstream steps, jobs, and stages.

AppServiceApplicationUrl
Application URL of the selected App Service.

Remarks

Use this task to deploy to a range of App Services on Azure. The task works on cross-platform agents running Windows, Linux, or Mac and uses several different underlying deployment technologies.

The task works for ASP.NET, ASP.NET Core, PHP, Java, Python, Go, and Node.js based web applications.

The task can be used to deploy to a range of Azure App Services such as:

Prerequisites for the task

The following prerequisites must be set up in the target machine(s) for the task to work correctly.

  • App Service instance. The task is used to deploy a Web App project or Azure Function project to an existing Azure App Service instance, which must exist before the task runs. The App Service instance can be created from the Azure portal and configured there. Alternatively, the Azure PowerShell task can be used to run AzureRM PowerShell scripts to provision and configure the Web App.

  • Azure Subscription. To deploy to Azure, an Azure subscription must be linked to the pipeline. The task does not work with the Azure Classic service connection, and it will not list these connections in the settings of the task.

Usage notes

  • The task works with the Azure Resource Manager APIs only.
  • To ignore SSL errors, define a variable named VSTS_ARM_REST_IGNORE_SSL_ERRORS with value true in the the pipeline. If you are deploying to a slot configured to auto-swap, the swap will fail unless you set SCM_SKIP_SSL_VALIDATION or 'SCM_SKIP_ASE_SSL_VALIDATION' to 1 in the app services configuration settings.
  • For .NET apps targeting Web App on Windows, avoid deployment failure with the error ERROR_FILE_IN_USE by ensuring that Rename locked files and Take App Offline settings are enabled. For zero downtime deployment, use the slot swap option.
  • When deploying to an App Service that has Application Insights configured, and you have enabled Remove additional files at destination, ensure you also enable Exclude files from the App_Data folder in order to maintain the Application insights extension in a safe state. This is required because the Application Insights continuous web job is installed into the App_Data folder.

Deployment methods

Several deployment methods are available in this task. Web Deploy (msdeploy.exe) is the default. To change the deployment option, 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 agent, the task chooses a suitable deployment technology. The different deployment technologies used by the task are:

By default, the task tries to select the appropriate deployment technology based on the input package type, App Service type, and agent operating system.

Auto Detect Logic

For windows based agents.

App Service type Package type Deployment Method
WebApp on Linux or Function App on Linux Folder/Zip/jar
War
Zip Deploy
War Deploy
WebApp for Containers (Linux) or Function App for Containers (Linux) Update the App settings NA
WebApp on Windows, Function App on Windows, API App, or Mobile App War
Jar
MsBuild package type or deploy to virtual application


Folder/Zip
War Deploy
Zip Deploy
Web Deploy

if postDeploymentScript == true, Zip Deploy
else, Run From Package

On non-Windows agents (for any App Service type), the task relies on Kudu REST APIs to deploy the app.

Web Deploy

Web Deploy (msdeploy.exe) can be used to deploy a Web App on Windows or a Function App to the Azure App Service using a Windows agent. Web Deploy is feature-rich and offers options such as:

  • Rename locked files: Rename any file that is still in use by the web server by enabling the msdeploy flag MSDEPLOY\_RENAME\_LOCKED\_FILES=1 in the Azure App Service settings. This option, if set, enables msdeploy to rename files that are locked during app deployment.

  • Remove additional files at destination: Deletes files in the Azure App Service that have no matching files in the App Service artifact package or folder being deployed.

  • Exclude files from the App_Data folder: Prevent files in the App_Data folder (in the artifact package/folder being deployed) being deployed to the Azure App Service

  • Additional Web Deploy arguments: Arguments that will be applied when deploying the Azure App Service. Example: -disableLink:AppPoolExtension -disableLink:ContentExtension. For more examples of Web Deploy operation settings, see Web Deploy Operation Settings.

Install Web Deploy on the agent using the Microsoft Web Platform Installer. Web Deploy 3.5 must be installed without the bundled SQL support. There is no need to choose any custom settings when installing Web Deploy. Web Deploy is installed at C:/Program Files (x86)/IIS/Microsoft Web Deploy V3.

Kudu REST APIs

Kudu REST APIs work on both Windows and Linux automation agents when the target is a Web App on Windows, Web App on Linux (built-in source), or Function App. The task uses Kudu to copy files to the Azure App service.

Container Registry

Works on both Windows and Linux automation agents when the target is a Web App for Containers. The task updates the app by setting the appropriate container registry, repository, image name, and tag information. You can also use the task to pass a startup command for the container image.

Zip Deploy

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

Run From Package

Expects 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 and files in the wwwroot folder become read-only. For more information, see Run your Azure Functions from a package file.

War Deploy

Expects a .war deployment package and deploys the file content to the wwwroot folder or webapps folder of the App Service in Azure.

Troubleshooting

Error: Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired.

The task uses the service principal in the service connection to authenticate with Azure. If the service principal has expired or doesn't have permissions to the App Service, the task fails with this error. Verify the validity of the service principal used and that it's present in the app registration. For more information, see Use role-based access control to manage access to your Azure subscription resources. This blog post also contains more information about using service principal authentication.

SSL error

If you want to use a certificate in App Service, the certificate must be signed by a trusted certificate authority. If your web app gives you certificate validation errors, you're probably using a self-signed certificate. Set a variable named VSTS_ARM_REST_IGNORE_SSL_ERRORS to the value true in the build or release pipeline to resolve the error.

A release hangs for long time and then fails

This problem could be the result of insufficient capacity in your App Service plan. To resolve this problem, you can scale up the App Service instance to increase available CPU, RAM, and disk space or try with a different App Service plan.

5xx error codes

If you're seeing a 5xx error, check the status of your Azure service.

Error: No package found with specified pattern

Check if the package mentioned in the task is published as an artifact in the build or a previous stage and downloaded in the current job.

Error: Publish using zip deploy option is not supported for msBuild package type

Web packages created via the MSBuild task (with default arguments) have a nested folder structure that can be deployed correctly only by Web Deploy. The publish-to-zip deployment option can't be used to deploy those packages. To convert the packaging structure, take these steps:

  1. In the Build solution task, change the MSBuild Arguments to /p:DeployOnBuild=true /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:DeleteExistingFiles=True /p:publishUrl="$(System.DefaultWorkingDirectory)\\WebAppContent":

    Screenshot that shows the Build solution values.

  2. Add an Archive task and change the values as follows:

    1. Change Root folder or file to archive to $(System.DefaultWorkingDirectory)\\WebAppContent.

    2. Clear the Prepend root folder name to archive paths check box:

      Screenshot that shows the Archive values.

Web app deployment on Windows is successful but the app is not working

This may be because web.config is not present in your app. You can either add a web.config file to your source or auto-generate one using the File Transforms and Variable Substitution Options of the task.

  • Click on the task and go to Generate web.config parameters for Python, Node.js, Go and Java apps.

    Screenshot of the Generate web.config parameters dialog.

  • Click on the more button Generate web.config parameters for Python, Node.js, Go and Java apps to edit the parameters.

    Screenshot of Application framework drop-down.

  • Select your application type from the drop down.

  • Click on OK. This will populate web.config parameters required to generate web.config.

Note

This section is deprecated and has been replaced with the File Transform task.

ERROR_FILE_IN_USE

When deploying .NET apps to Web App on Windows, deployment may fail with error code ERROR_FILE_IN_USE. To resolve the error, ensure Rename locked files and Take App Offline options are enabled in the task. For zero downtime deployments, use slot swap.

You can also use Run From Package deployment method to avoid resource locking.

Web Deploy Error

If you are using web deploy to deploy your app, in some error scenarios Web Deploy will show an error code in the log. To troubleshoot a web deploy error, see Web Deploy error codes.

Web app deployment on App Service Environment (ASE) is not working

  • Ensure that the Azure DevOps build agent is on the same VNET (subnet can be different) as the Internal Load Balancer (ILB) of ASE. This will enable the agent to pull code from Azure DevOps and deploy to ASE.
  • If you are using Azure DevOps, the agent doesn't need to be accessible from the internet but needs only outbound access to connect to Azure DevOps Service.
  • If you are using TFS/Azure DevOps Server deployed in a Virtual Network, the agent can be completely isolated.
  • The build agent must be configured with the DNS configuration of the Web App it needs to deploy to. Since the private resources in the Virtual Network don't have entries in Azure DNS, this needs to be added to the hosts file on the agent machine.
  • If a self-signed certificate is used for the ASE configuration, the -allowUntrusted option needs to be set in the deploy task for MSDeploy. It is also recommended to set the variable VSTS_ARM_REST_IGNORE_SSL_ERRORS to true. If a certificate from a certificate authority is used for ASE configuration, this should not be necessary. If you are deploying to a slot configured to auto-swap, the swap will fail unless you set SCM_SKIP_SSL_VALIDATION or SCM_SKIP_ASE_SSL_VALIDATION to 1 in the app services configuration settings.

FAQs

How should I configure my service connection?

This task requires an Azure Resource Manager service connection.

How should I configure web job deployment with Application Insights?

When you're deploying to an App Service, if you have Application Insights configured and you've enabled Remove additional files at destination, you also need to enable Exclude files from the App_Data folder. Enabling this option keeps the Application Insights extension in a safe state. This step is required because the Application Insights continuous WebJob is installed into the App_Data folder.

How should I configure my agent if it's behind a proxy while I'm deploying to App Service?

If your self-hosted agent requires a web proxy, you can inform the agent about the proxy during configuration. Doing so allows your agent to connect to Azure Pipelines or Azure DevOps Server through the proxy. Learn more about running a self-hosted agent behind a web proxy.

Examples

Deploy to specific app type

To deploy to a specific app type, set appType to any of the following accepted values: webApp (Web App on Windows), webAppLinux (Web App on Linux), webAppContainer (Web App for Containers - Linux), functionApp (Function App on Windows), functionAppLinux (Function App on Linux), functionAppContainer (Function App for Containers - Linux), apiApp (API App), mobileApp (Mobile App). If not mentioned, webApp is taken as the default value.

To enable any advanced deployment options, add the parameter enableCustomDeployment: true and include the following parameters as needed.

# deploymentMethod: 'runFromPackage' # supports zipDeploy as well
    # appOffline: boolean    # Not applicable for 'runFromPackage'
    # setParametersFile: string
    # removeAdditionalFilesFlag: boolean
    # additionalArguments: string

Deploy to Azure Web App Linux container

The following YAML example deploys to an Azure Web App container (Linux).

pool:
  vmImage: ubuntu-latest

variables:
  azureSubscriptionEndpoint: Contoso
  DockerNamespace: contoso.azurecr.io
  DockerRepository: aspnetcore
  WebAppName: containersdemoapp

steps:

- task: AzureRMWebAppDeployment@4
  displayName: Azure App Service Deploy
  inputs:
    appType: webAppContainer
    ConnectedServiceName: $(azureSubscriptionEndpoint)
    WebAppName: $(WebAppName)
    DockerNamespace: $(DockerNamespace)
    DockerRepository: $(DockerRepository)
    DockerImageTag: $(Build.BuildId)

Deploy a web app to a Windows App Service across deployment slots

The following example deploys a web app to a Windows App Service across deployment slots.

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
 - stage: DeployDevStage
    displayName: 'Deploy App to Dev Slot'
    jobs:
      - job:  DeployApp
        displayName: 'Deploy App'
        steps:
        - task: DownloadPipelineArtifact@2
          inputs:
            buildType: 'current'
            artifactName: 'drop'
            targetPath: '$(System.DefaultWorkingDirectory)'
        - task: AzureRmWebAppDeployment@4
          inputs:
            ConnectionType: 'AzureRM'
            azureSubscription: 'Fabrikam Azure Subscription - PartsUnlimited'
            appType: 'webApp'
            WebAppName: 'partsunlimited'
            deployToSlotOrASE: true
            ResourceGroupName: 'rgPartsUnlimited'
            SlotName: 'Dev'
            packageForLinux: '$(System.DefaultWorkingDirectory)/**/*.zip'

  - stage: DeployStagingStage
    displayName: 'Deploy App to Staging Slot'
    dependsOn: DeployDevStage
    jobs:
      - job:  DeployApp
        displayName: 'Deploy App'
        steps:
        - task: DownloadPipelineArtifact@2
          inputs:
            buildType: 'current'
            artifactName: 'drop'
            targetPath: '$(System.DefaultWorkingDirectory)'
        - task: AzureRmWebAppDeployment@4
          inputs:
            appType: webApp
            ConnectionType: AzureRM            
            ConnectedServiceName: 'Fabrikam Azure Subscription - PartsUnlimited'
            ResourceGroupName: 'rgPartsUnlimited'
            WebAppName: 'partsunlimited'
            Package: '$(System.DefaultWorkingDirectory)/**/*.zip'
            deployToSlotOrASE: true
            SlotName: 'staging'

Sample Post deployment script

The task provides an option to customize the deployment by providing a script that will run on the Azure App Service after the app's artifacts have been successfully copied to the App Service. You can choose to provide either an inline deployment script or the path and name of a script file in your artifact folder.

This is very useful when you want to restore your application dependencies directly on the App Service. Restoring packages for Node, PHP, and python apps helps to avoid timeouts when the application dependency results in a large artifact being copied over from the agent to the Azure App Service.

An example of a deployment script is:

@echo off
if NOT exist requirements.txt (
 echo No Requirements.txt found.
 EXIT /b 0
)
if NOT exist "$(PYTHON_EXT)/python.exe" (
 echo Python extension not available >&2
 EXIT /b 1
)
echo Installing dependencies
call "$(PYTHON_EXT)/python.exe" -m pip install -U setuptools
if %errorlevel% NEQ 0 (
 echo Failed to install setuptools >&2
 EXIT /b 1
)
call "$(PYTHON_EXT)/python.exe" -m pip install -r requirements.txt
if %errorlevel% NEQ 0 (
 echo Failed to install dependencies>&2
 EXIT /b 1
)

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 2.104.1 or greater
Task category Deploy

See also

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