Create an Azure Web App Using CLI
A short guide on how to create an Azure Web App using Bash CLI
- Sign to Azure Portal.
- Create a Web App using Azure CLI.
- Get the Deployed App URL.
- Test the deployment from the browser.
Login to Azure Portal
- Open a browser tab in incognito mode. Go to the Azure portal by clicking on the
- 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.
- First You have to click on the Azure Cloud shell icon in Azure Portal
- Click on Bash
- Click on the Show Advanced Settings option
- You have to fill in the details that are shown for mounting the storage account
- Click on Create New and give a Global Unique name for the storage account
- Click on Create File Share and give a name for the File Share which doesn’t need to be globally unique
- After Filling in all the details, click on Create Storage and wait for some time
- After some time you will be able to see an Image like this
- 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
- Click on App services in the left-hand panel of the Azure portal
- Go to the WebApp that you have created
- Click on the URL that is present and you will be redirected to the home page of the image that you have created.
- 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
- Switch back to the OverView Page of Web App Created. If you scroll down, You can see several charts
- Hit the App URL 4–5 Times to simulate the request-response cycle.
- Please wait for 2–5 minutes and refresh the page if the graph does not show the traffic details.
- You should be able to see the corresponding telemetry displayed in the charts.
- These Charts will provide a clear understanding of traffic you are getting on the New Web App created.
- 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.