DEV Community

Cover image for Deploy A WebApp With ARM Templates And Azure CLI
Abisola Adesegun
Abisola Adesegun

Posted on

Deploy A WebApp With ARM Templates And Azure CLI

Table of Contents
Step 1: Introduction
Step 2: Set Up Your Environment
Step 3: Create an ARM Template
Step 4: Deploy the ARM Template Using Azure CLI
Step 5: Verify the Deployment
Step 6: Prepare your Git repository
Step 7: Verify Deployment
Step 8: Conclusion

Step 1: Introduction
An ARM template is a JSON file that defines the infrastructure and configuration for the resources you want to deploy. You can deploy an ARM template from your local machine or one that is stored externally. Below is a basic ARM template for deploying an Azure Web App.

Step 2: Set Up Your Environment
Install Azure CLI: Make sure you have the Azure CLI installed on your machine. You can download it from here.
Login to Azure: Use the command below to login to your Azure account.

Image description

Step 3: Create an ARM Template
Here are two ARM templates (azuredeploy.json and parameter.json) to deploy an Azure Web App:

azuredeploy.json
Image description

parameter.json

Image description

Step 4: Deploy the ARM Template Using Azure CLI

  • Get a path where all your documents will be saved by creating a folder. Right click on the folder and select Git Bash Here

Image description

  • Right click on the folder and select Git Bash Here and run command will open the path on Git bash.

Image description

  • Create a new folder and enter

Image description

Image description

  • Create two files named:azuredeploy.json and parameter.json

Image description

  • Paste the json codes and save.

Image description

Image description

  • Create a Resource group

Image description

  • Deploy

Image description

Step 5: Verify the Deployment
Check the Resource Group

  • In the Azure Portal, navigate to the abisola1RG.

  • You should see the App Service Plan and the Web App listed under the resources.

Image description

Access the Web App

In the Azure Portal, navigate to the deployed Web App.

  • The URL for your Web App will be something like http://.azurewebsites.net.

  • Open this URL in your browser to verify the deployment.

Image description

**Step 6: Prepare your Git repository

**

Source for a website on themewagon and extract file.

Image description

  • create a new Repository

Image description

Image description

  • Run the following commands to push the website to repository

Image description

Image description

Commit
Image description

Image description

Push

Image description

  • Deploy the website

Image description

Image description

Step 7: Verify Deployment

Check the deployment status and ensure your web app is running correctly:

Image description

  • Navigate to your web app in the Azure Portal to view logs and check the deployment status. Image description

Image description

Image description

Step 8: Conclusion
By following these steps, you have successfully deployed a web app using ARM templates and Azure CLI. This method allows for a repeatable and consistent deployment process, which is particularly useful in production environments and for automating infrastructure as code (IaC).

Top comments (0)