Deploy web app on Azure App Service using Terraform

Ritesh Singh
2 min readMay 24, 2021

--

Problem statement

  • Deploy web app on Azure App service
  • Use Azure registry Container for deployment.
  • Provision using terraform.

Prerequisites

  • Azure account
  • Azure CLI configured in OS

Solution:

First, we need to create one docker image and push it to the Azure Container registry, and after write terraform code for provision.

Step-1)Create and Push image in Azure Container Registry

Step-2)Write Terraform Code

  • In Azure first, we need to create a resource group so for this we need to use azurerm_resource_group
  • After that, we need to define a service plan(azurerm_app_service_plan), in the service plan we need to also define kind=” Linux” for Linux Operating System.
  • Now for the Publish( we need to choose Docker for azure container Registry), as we need to define the URL, USERNAME, PASSWORD of the Azure Container for pulling the image.
  • We need to define the Docker image use site_config as we have already defined that kind=” Linux” so we need to use linux_fx_version.
  • app_setting(for apply the app setting like local env variables)

--

--