Create an Azure Web App Using CLI

Abraham Reyes
4 min readSep 24, 2021

--

A short guide on how to create an Azure Web App using Bash CLI

  1. Sign to Azure Portal.
  2. Create a Web App using Azure CLI.
  3. Get the Deployed App URL.
  4. Test the deployment from the browser.

Login to Azure Portal

  1. Open a browser tab in incognito mode. Go to the Azure portal by clicking on the
  2. URL https://portal.azure.com in incognito mode.

Note: It is recommended to use incognito mode to avoid Azure portal cache-related issues.

If it automatically logs into any other azure account, please log out of it and clear the cache.

Introduction

Azure App Service is a collection of four services, which are built to help you host and run web applications.

The four services are

  • Web Apps
  • Mobile Apps
  • API Apps
  • Logic Apps

Although they look different, in the end, they all operate in very similar ways. Web Apps are the most commonly used.

Create a Web App using Azure CLI.

  1. First You have to click on the Azure Cloud shell icon in Azure Portal
  2. Click on Bash
  3. Click on the Show Advanced Settings option
  4. You have to fill in the details that are shown for mounting the storage account
  5. Click on Create New and give a Global Unique name for the storage account
  6. Click on Create File Share and give a name for the File Share which doesn’t need to be globally unique
  7. After Filling in all the details, click on Create Storage and wait for some time
  8. After some time you will be able to see an Image like this
  9. Now to create a web app in Azure, First, you have to create an app service plan

Using the below command you can create an app service plan

az appservice plan create — name “name of appservice plan without quotes” \

— resource-group “name of the resource group without any quotes“ \

— is-linux

Now after creating the app service plan you have to create the web app

Using the below command you can create the web app

az webapp create — resource-group “name of resource group without quotes” \
— plan “name of the appservice plan you have created” \

— name “Unique name for the webapp” \

— deployment-container-image-name nginx

After executing the commands wait for some time until the app service plan and web app is created

These are the things you will see after creating the app service plan and web app through the commands specified

Get the Deployed App URL

  1. Click on App services in the left-hand panel of the Azure portal
  1. Go to the WebApp that you have created
  2. Click on the URL that is present and you will be redirected to the home page of the image that you have created.
  1. In my case the image that I have used is Nginx, SO I will be able to see the home page of the Nginx

Task 4: Understanding Charts

  1. Switch back to the OverView Page of Web App Created. If you scroll down, You can see several charts
  2. Hit the App URL 4–5 Times to simulate the request-response cycle.
  3. Please wait for 2–5 minutes and refresh the page if the graph does not show the traffic details.
  4. You should be able to see the corresponding telemetry displayed in the charts.
  5. These Charts will provide a clear understanding of traffic you are getting on the New Web App created.
  6. This will include HTTP 5xx, Data In, Data Out, Requests(Number of requests), Response Time.

What the charts show:

  • HTTP 5xx Chart: HTTP 5xx responses indicate the server issues. A sudden spike in the number of 5xx responses can be the result of the following:
  • Deploying new code which contained a bug.
  • Errors returned by upstream services that your application depends on.
  • Your application is overwhelmed by the amount of traffic it is receiving.
  • Issues in the configuration for your app service.
  • Data In: Provides details of incoming data to the Web App.
  • Data Out: Provides details of outgoing data from the Web App.
  • Requests: Shows details of a number of requests received by Web app over the period of time.
  • Response Time: This shows how much time Web App took to respond back to the requests it is receiving over the period of time.

Now you know how to create a New Web App using Azure CLI.

We have gone through and tested the Web app using App URL.

We have monitored the app traffic stats and detailed analysis using the charts provided.

--

--