Deploying Azure AppService using Terraform Script

Posted By :Ankit Kumar |30th October 2019

Let's first find out what an azure app service is !!  
Azure AppService is a Platform as a service (PaaS) cloud computing-based platform for hosting websites, created and managed by Microsoft. Azure appService includes multiple services(Azure Website, Azure Mobile services and Azure BizTalk ) that were previously delivered separately.

Being involved with Terraform configurations is done in three steps:

1> Create a configuration 2> Initialize the terraform state 3> Apply the configuration

1. Create an Azure App Service
Now that we’ve seen what an Azure App Service is, let us dive deep and create a new App Service in Azure.


Create a terraform script file named


To provision an appservice we need.

(a) Resource Group (b) AppService Plan (c) App Service


Now make the following configuration entries here.


#This section creates a azure Resource Group named "myrg"

resource "azurerm_resource_group" "stage" {   name     = "myrg"   location = "West Europe" }

#Create a App Service Plan named "myplan".

resource "azurerm_app_service_plan" "stage" {   name                = "myplan"   location            = "${azurerm_resource_group.stage.location}"   resource_group_name = "${}"   sku {     tier = "Free"     size = "F1"   } }

#Create a App Service named "myappsrvc"

resource "azurerm_app_service" "stage" {   name                = "myappsrvc"   location            = "${azurerm_resource_group.stage.location}"   resource_group_name = "${}"   app_service_plan_id = "${}" }

2. Initialize the terraform state
Before we start applying this configuration to your azure environment we need to initialliz terraform in the current folder in order to get it working with our script:

terraform init 

This will download the required modules for our repository and setup any local files that our terraform script needs.

terraform init


3. Apply the configuration
Once initialization is done. it is time to apply our configuration to our azure environment.


terraform apply


This will deploy a new desired state for your environment. 

Thanks for Reading

About Author

Ankit Kumar

RedHat certified in System Administration as well as Ansible Automation. A self-motivated professional with excellent research skill, enthusiasm to learn new things and always try to do his best

Request For Proposal

[contact-form-7 404 "Not Found"]

Ready to innovate ? Let's get in touch

Chat With Us