Deploy to Azure Web App for Containers

Azure Pipelines

With Azure Web App for Containers, you can easily deploy and run container-based web apps on Windows and Linux. In this quickstart, we will use Azure Pipelines to build and deploy our sample application to Web App for Containers App service.

With Azure Pipelines, you can implement a CI/CD workflow to automatically generate build Artifacts and trigger deployment to specific environments.

CI/CD workflow


Get the code

Fork or clone the sample app to follow along with this tutorial.

Build and publish a Docker image to an Azure Container Registry

To complete this section successfully, you must have an Azure Container Registry. Refer to the prerequisites section for details.

  1. Sign in to your Azure DevOps organization and navigate to your project.

  2. Select Pipelines, and then New Pipeline.

  3. Select GitHub when prompted for the location of your source code, and then select your repository.

  4. Select the Docker: build and push an image to Azure Container Registry pipeline template.

    Select Docker pipeline template

  5. Select your Azure Subscription, and then select Continue.

  6. Select your Container registry from the drop-down menu, and then select Validate and configure.

    Validate and configure Docker

  7. Review the pipeline YAML template, and then select Save and run to build and publish the Docker image to your Azure Container Registry.

    - master
    - repo: self
        # Container registry service connection established during pipeline creation
        dockerRegistryServiceConnection: '{{ containerRegistryConnection.Id }}'
        imageRepository: 'javascriptdocker'
        containerRegistry: ''
        dockerfilePath: '$(Build.SourcesDirectory)/app/Dockerfile'
        tag: '$(Build.BuildId)'
        # Agent VM image name
        vmImageName: 'ubuntu-latest'
    - stage: Build
        displayName: Build and push stage
        - job: Build
        displayName: Build
            vmImage: $(vmImageName)
        - task: Docker@2
            displayName: Build and push an image to container registry
            command: buildAndPush
            repository: $(imageRepository)
            dockerfile: $(dockerfilePath)
            containerRegistry: $(dockerRegistryServiceConnection)
            tags: |
  8. To view the published docker image after your pipeline run has been completed, navigate to your container registry in Azure portal, and then select Repositories.

    Docker image published to Azure Container Registry

  9. To deploy your image from the container registry, you must enable the admin user account. Navigate to your container registry in Azure portal, and select Access keys. Next, select the toggle button to Enable Admin user.

    Enable Admin user

Create an Azure Web App for Containers

  1. Sign into Azure at

  2. In the Azure portal, choose Create a resource > Containers, and then choose Web App for Containers.

    Create a web app for containers resource

  3. Enter a name for your new web app, and select or create a new Resource Group. Select Linux for the Operating System.

    Configure the web app

  4. In the SKU and Size section, select Change to specify the pricing tier. Select the Dev/Test plan, and then choose the F1 Free plan. Select Apply when you are done.

    Change pricing tier to free

  5. Select Review and create. Review your configuration, and select Create when you are done.

Create a release pipeline

  1. From within your project, select Pipelines then Release.

  2. Select New pipeline to create a new release pipeline.

  3. Select the Azure App Service deployment template

    Azure App Service template

  4. Select Tasks, then Unlink all in stage 1 to unlink all the pipeline parameters.

    Unlink pipeline parameters

  5. Select the Deploy Azure App Service task, and fill out the required fields. Select Save when you are done.

    Deploy Azure App Service task

  6. Select Create release, and then choose Stage 1 from the dropdown menu. Select Create when you are done.

    Create a release pipeline

  7. Hover over Stage 1 in your pipeline, and select Deploy to queue and start the deployment.

    Queue and deploy Docker image

  8. Your pipeline logs should look similar to the screenshot below.

    Pipeline logs

  9. Navigate to your newly deployed web app to verify your deployment.

    Web app deployed. Hello World message

Next steps