DEV Community

Cover image for DEPLOYING A WEB APPLICATION WITH ARM TEMPLATE AND AZURE CLI
Seyi Lufadeju
Seyi Lufadeju

Posted on

DEPLOYING A WEB APPLICATION WITH ARM TEMPLATE AND AZURE CLI

INTRODUCTION
Azure provides a robust environment for deploying and managing web applications. ARM templates are JSON or Bicep files that specify the infrastructure and configuration of your Azure resources. They enable repeatable deployments and infrastructure-as-code (IaC) practices. Azure CLI complements this approach by providing commands to manage Azure resources from a terminal or shell script.

Deploying a web app using these tools ensures:

  • Consistency: Every deployment follows the exact specifications defined in the template.
  • Automation: Reduces manual configuration errors and saves time.
  • Scalability: Easily modify the template to scale resources or deploy additional environments.

Pre-requisites

  • Azure Subscription: An active Azure account. Sign up here if you don’t have one.
  • Azure CLI: Installed and configured on your machine. Installation guide.
  • Text Editor: For editing ARM templates (e.g., VS Code).
  • Basic Knowledge: Familiarity with JSON and Azure Web Apps.

Step-by-Step Guide

  • Step 1: Prepare the ARM Template Create a JSON file for your ARM template (e.g., webapp-template.json). Define the required resources. A simple ARM template for an Azure Web App might look like this:

Image description
Save the file.

  • Step 2: Create a Parameter File Create a parameters file (e.g., webapp-parameters.json) to define the values for the template parameters:

Image description

Save the file.

  • Step 3: Log in to Azure
  1. Open a terminal.
  2. Log in to Azure:

az login

  • Step 4: Create a Resource Group

Create a resource group where the web app will be deployed:

Image description

  • Step 5: Deploy the ARM Template

Deploy the ARM template using Azure CLI. Use the following command if you have a parameters file:

az deployment group create --resource-group webRG --template-file template.json --parameters parameters.json

Image description

  • Step 6: Connect Github Repository to Azure using this code: az webapp deployment source config --name seyiwebapp555 --resource-group websiteRG --repo-url https://github.com/lufadeju/my-web-app2 --branch master --manual-integration

Image description

  • Step 7: Test the Web App Navigate to the web app URL provided in the Azure Portal or from the CLI output.

Image description

Image description

Confirm that the web app is running.

Image description

Conclusion
This guide demonstrates how to deploy a web app using ARM templates and Azure CLI. By adopting these tools, you ensure a consistent and automated approach to managing Azure resources. You can extend the template to include additional configurations like custom domains, SSL bindings, or CI/CD pipelines.

Image of Docusign

πŸ› οΈ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

πŸ‘‹ Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay