1node.si
← Registry

ado-azure-webapp-deployment

cleared

Azure Pipelines deployment to App Service using AzureRmWebAppDeployment@4: PublishProfile + password secret, or Azure Resource Manager service connection with packageForLinux and StartupCommand for Linux .NET. Covers deployment jobs, environments, and optional SetParameters.xml overrides. Use when wiring ADO stages after DotNetCoreCLI publish artifacts.

files.jsonSKILL.md
---
name: ado-azure-webapp-deployment
description: >-
  Azure Pipelines deployment to App Service using AzureRmWebAppDeployment@4:
  PublishProfile + password secret, or Azure Resource Manager service connection
  with packageForLinux and StartupCommand for Linux .NET. Covers deployment
  jobs, environments, and optional SetParameters.xml overrides. Use when wiring
  ADO stages after DotNetCoreCLI publish artifacts.
---

# Azure Pipelines: Azure Web App deployment (`AzureRmWebAppDeployment@4`)

## Prerequisites

- A published package from **`ado-dotnet-build-publish`** (zip for Linux, or web deploy package / zip for Windows).
- Either an **Azure Resource Manager** service connection, or **publish profiles** plus a secret password variable.
- Azure Pipelines **environments** (Test / Staging / Production) if you need approval gates—see **`ci-cd-pipeline-foundation`**.

## Authentication modes

| Mode | `ConnectionType` | Typical inputs |
|------|------------------|----------------|
| **Publish profile** | `PublishProfile` | `PublishProfilePath` (often from a downloaded `publishprofiles` artifact), `PublishProfilePassword` from a secret variable |
| **ARM / service connection** | `AzureRM` | `azureSubscription`, `WebAppName`, `appType` (e.g. `webAppLinux`), `packageForLinux` path to `.zip` |

Linux ASP.NET Core usually needs `StartupCommand`: `dotnet MyApp.Web.dll` matching the published assembly name.

## Job shape

Use `deployment` jobs with `environment:` and `strategy.runOnce.deploy.steps`.

Set `pool:` to `ubuntu-latest` for Linux zip deploy, or `windows-2022` when the task or packaging requires a Windows agent.

## SetParameters.xml (IIS)

Some IIS / MSDeploy deployments rewrite `SetParameters.xml` with `PowerShell@2` `Set-Content` so `IIS Web Application Name` matches the target site or slot. Keep that snippet next to the pipeline or in repo docs; validate the XML before relying on it in production.

## Artifact paths

After the deploy job downloads artifacts, packages land under `$(Pipeline.Workspace)/<ArtifactName>/...`. Align `packageForLinux` (or the Windows package path) with the `DotNetCoreCLI` `zipAfterPublish` / package output from **`ado-dotnet-build-publish`**.

## YAML

See [reference.md](reference.md).