Deploy A WebApp With ARM Templates And Azure CLI
Abisola Adesegun
Posted on August 26, 2024
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.
Step 3: Create an ARM Template
Here are two ARM templates (azuredeploy.json and parameter.json) to deploy an Azure Web App:
parameter.json
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
- Right click on the folder and select Git Bash Here and run command will open the path on Git bash.
- Create a new folder and enter
- Create two files named:azuredeploy.json and parameter.json
- Paste the json codes and save.
- Create a Resource group
- Deploy
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.
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.
**Step 6: Prepare your Git repository
**
Source for a website on themewagon and extract file.
- create a new Repository
- Run the following commands to push the website to repository
Push
- Deploy the website
Step 7: Verify Deployment
Check the deployment status and ensure your web app is running correctly:
- Navigate to your web app in the Azure Portal to view logs and check the deployment status.
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).
Posted on August 26, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.