Saturday, May 11, 2019

Deploy Container to Web App–Part 2

This post explains how to deploy a container image to azure app service web app using Azure DevOps.In the previous post Deploy Container to Web App - Part 1, we have learned how to build and push container image to the Azure container registry(ACR) using Azure DevOps build.Let’s learn how to deploy the ACR image to Azure app service web app using Azure DevOps deployment pipeline.
Find the steps as follows.

  • Let’s begin by creating an Azure app service web app.
  • Login to the Azure portal with your subscription.
  • Select Create a resource and then select Web App

  • Now you would be navigated to web app creation wizard.Under basic details tab enter following details.


1- Select the subscription where you have created your resource group
2 - Select the resource group of ACR
3 – Give name of web app
4 – We are going to deploy a docker image.So select docker image.
5 – We are going to deploy a Linux container image.So select Linux as the OS.
6 – Select data center location
7 – You can customize the web app cost with app service plan section.
8 - Go to Next step and provide docker image details


1 – We use single container.So select single container option.
2 – Give the location of the image.We are going to deploy the image in ACR.So select the Azure container registry from the drop down.
3 – Select the ACR name from the drop down
4 – Select the image name from the drop down
5 – Select the image tag from the drop down.This is the build definition id we have created in the previous post.

  • Then you would be able to see monitoring and tags sections.These values are not mandatory.So Click Review and Create button to create a app service web app.
  • We have created a web app.Let’s try to create a deployment pipeline.
  • Go to Azure DevOps pipelines.
  • Select new pipeline button of release section and select Azure App Service deployment task.

  • Add the build definition which build and push image to ACR as the artifact.
  • Now we can add release variables.Let’s add two variables.One for web app name and other one for registry name.Other than this we have to link the variable group which we have created to define ImageName variable in the previous post.


1 – Give the  login server value of the ACR where you have store the image.To find the login server value,go to Azure portal and open the ACR you have created.


2 – Give the name of the web app you have created.

  • Go to task section of the pipeline and provide relevant details.


1 – Select the subscription of the resource group
2 – We have created a web app to deploy Linux container image.So select Web App for Containers( Linux) from the drop down.
3 – Give the variable of the name of app service
4 – Give the variable of the login server value of the ACR
5 – Give the image name variable which contains the ACR repository name
Deploy Azure App Service task values get filled automatically when fill the stage1 values.So now we can trigger a release to deploy the image.

  • If the deployment succeed, You would be able to navigate to the application.


So you have learned how to deploy the container image in the ACR to Azure App Service web app using Azure DevOps release pipelines.Let’s discuss more about azure app service deployment with Azure DevOps in future posts.

No comments:

Post a Comment