Deploy to an Azure Web App for Containers

Azure Pipelines

We'll show you how to set up continuous deployment of your Docker-enabled app to an Azure Web App using Azure Pipelines.

For example, you can continuously deliver your app to a Windows VM hosted in Azure.

A typical release pipeline for web applications

After you commit and push a code change, it is automatically built and then deployed. The results will automatically show up on your site.

Get the code

If you want some sample code that works with this guidance, import (into Azure DevOps) or fork (into GitHub) the following repository, based on the desired runtime.

If you already have an app in GitHub that you want to deploy, you can create a pipeline for that code.

If you are a new user, fork this repo in GitHub:

Define your CI build pipeline

Set up a CI pipeline for building an image and pushing it to a container registry.


You'll need an Azure subscription. You can get one free through Visual Studio Dev Essentials.

Create an Azure Web App to host a container

  1. Sign into Azure at

  2. In the Azure Portal, choose Create a resource, Web, then choose Web App for Containers.

  3. Enter a name for your new web app, and select or create a new Resource Group. For the OS, choose Linux.

  4. Choose Configure container and select Azure Container Registry. Use the drop-down lists to select the registry you created earlier, and the Docker image and tag that was generated by the build pipeline.

  5. Wait until the new web app has been created. Then you can create a release pipeline as shown in the next section.

The Docker tasks you used in the build pipeline when you created the build artifacts push the Docker image back into your Azure Container Registry. The web app you created here will host an instance of that image and expose it as a website.

Why use a separate release pipeline instead of the automatic deployment feature available in Web App for Containers?

You can configure Web App for Containers to automatically configure deployment as part of the CI/CD pipeline so that the web app is automatically updated when a new image is pushed to the container registry (this feature uses a webhook). However, by using a separate release pipeline in Azure Pipelines or TFS you gain extra flexibility and traceability. You can:

  • Specify an appropriate tag that is used to select the deployment target for multi-stage deployments.
  • Use separate container registries for different stages.
  • Use parameterized start-up commands to, for example, set the values of variables based on the target stage.
  • Avoid using the same tag for all the deployments. The default CD pipeline for Web App for Containers uses the same tag for every deployment. While this may be appropriate for a tag such as latest, you can achieve end-to-end traceability from code to deployment by using a build-specific tag for each deployment. For example, the Docker build tasks let you tag your images with the Build.ID for each deployment.

Create a release pipeline

  1. In Azure Pipelines, open the build summary for your build and choose Release to start a new release pipeline.

    If you have previously created a release pipeline that uses these build artifacts, you will be prompted to create a new release instead. In that case, go to the Releases tab page and start a new release pipeline from there by choosing the + icon.

  2. Select the Azure App Service Deployment template and choose Apply.

  3. Open the Tasks tab and select the Stage 1 item. In the settings panel next to Parameters, choose Unlink all.

  4. Select the Deploy Azure App Service task and configure the settings as follows:

    • Version: Select 4.* (preview).

    • Azure Subscription: Select a connection from the list under Available Azure Service Connections or create a more restricted permissions connection to your Azure subscription. If you are using Azure Pipelines and if you see an Authorize button next to the input, click on it to authorize Azure Pipelines to connect to your Azure subscription. If you are using TFS or if you do not see the desired Azure subscription in the list of subscriptions, see Azure Resource Manager service connection to manually set up the connection.

    • App Service type: Select Web App for Containers.

    • App Service name: Select the web app you created earlier from your subscription. App services based on selected app type will only be listed.

    When you select the Docker-enabled app type, the task recognizes that it is a containerized app, and changes the property settings to show the following:

    • Registry or Namespace: Enter the path to your Azure Container Registry which is a globally unique top-level domain name for your specific registry or namespace. Typically this is

    • Image: Name of the repository where the container images are stored.

    • Tag: Tags are optional, it is the mechanism that registries use to give Docker images a version. A fully qualified image name will be of the format: '/:'. For example, ''.

    • Startup command: Start up command for the container.

  5. Save the release pipeline.

Create a release to deploy your app

You're now ready to create a release, which means to run the release pipeline with the artifacts produced by a specific build. This will result in deploying the build:

  1. Choose + Release and select Create a release.

  2. In the Create a new release panel, check that the artifact version you want to use is selected and choose Create.

  3. Choose the release link in the information bar message. For example: "Release Release-1 has been created".

  4. In the pipeline view, choose the status link in the stages of the pipeline to see the logs and agent output.

  5. After the release is complete, navigate to your site running in Azure using the Web App URL http://{web_app_name}, and verify its contents.

Next steps