ASP .NET Application with Azure Webapps (Container)


Hello Reader,

Today we will go through an example scenario where the customer wants to modernize their ASP .NET Core Employee   management application and they are having below requirement

  1. Plan to efficient and effective cloud migration strategy.
  • No plan to re-architect legacy applications.
  • They want to have control over the runtime, framework, tooling, and packages of the web-based application.
  • Take full advantage of cloud benefits, such as scalability and high availability.
  • Supports modern development and faster app start-up.
  • Container orchestration is not needed
  • Automated build and deployment.

Key solution:

  • Containerize application architecture.
  • Use WebApp as container (Paas service).
  • Use Azure container registry for Private Image repository for Docker image management.
  • CI/CD deployment process.

2.    Pre-Requisites

Based on the requirements the following azure components are recommended:

  • Azure Subscription (Active state)
  • App service Plan – Standard Tier
  • Web App for Docker Container (Linux)
  • ACR (Image Repository)
  • Azure pipeline (To build Image)

3.    Architecture

                                Please find below the architecture flow

  1. Developer modifies the existing code using Visual studio IDE
  • Developer pushes the code to Azure Repo.
  • Azure build pipeline is triggered based on Repo changes and will copy required files.
  • Azure pipelines invokes Docker build step which reads the instruction on Docker file and creates a Docker image.
  • Azure pipelines invokes Docker push step which pushes the image to Azure container Registry.
  • Once a new image is pushed into azure container registry, web hooks gets triggered (Continuous deployment) .Web hook passes required information to Web app that new image is available.
  • The latest images gets deployed from ACR into azure web app

4.    Docker file

Docker file contains collections of commands and instructions that will be automatically executed in sequence in the docker environment for building a new docker image.

          Please find the Docker file details below

Docker file location

5.    Azure Repository

Azure Repos is a set of version control tools that you can use to manage your code.

         Application code and Docker file changes are stored in Azure Repo

6.    Azure Container registry

Azure Container Registry allows you to build, store, and manage container images and artifacts in a private registry for all types of container deployments

Creating – Container Registry

Container Registry –Overview Page

7.    Continuous Build – Azure Build pipeline

Azure Pipelines is a cloud service that you can use to automatically build and test our code project and make it available to other users.

We are using Azure build pipeline to create an image and push it to the Azure container registry.

Please find build Pipeline Docker setting and Container repository setting below

8.    Azure App Service

Azure App Service enables you to build and host web apps and RESTful APIs in the programming language of our choice without managing infrastructure.

Application app service Main page

9.    Continuous deployment

We will be using Continuous deployment for deploying custom container images on Azure web app from managed Azure Container Registry repositories

   Enable continuous deployment with ACR

10.     Webhooks

Once Continuous Deployment has been enabled, we can view the newly created webhook on your Azure Container Registry webhooks page

11.     Testing Result

  1. When user commit’s the changes , the code will be pushed to repository
  • Azure build pipeline triggered automatically based on the repo changes
  • Azure pipeline Build step will complete  the required Docker image creation
  • Azure pipeline -Push step will push  the image to Azure container registry
  • An image entry is  available in Azure container registry as shown below

6. Web hook (Continuous deployment) will be deploying the latest Image to the   Azure web app

And you are ready to hit you url .

Leave a Reply

Your email address will not be published. Required fields are marked *