How to create a webapp in Azure using CLI like a ninja.

How to create a webapp in Azure using CLI like a ninja.

In this article, I will be demonstrating how to use the cli commands in Cloud Shell like a ninja to create a basic web app.

The first thing to do is log in to the Azure portal. I also made sure to have a valid subscription.

As indicated in the diagram below, I clicked on the cloud shell.

Also, I don't have any resource groups yet under this subscription.

So Azure will create a storage for me under a resource group for me to be able to use the cloud shell when I click on create storage.

Here, as indicated in the diagram below, is the first command to show me the resource group they created.

As can be seen in the Azure portal, shown in the diagram below,

Now in the cloud shell, I type the command "az group create" and press enter so that the az AI will tell me the parameters I will have to be able to create a resource group, as shown in the diagram below.

I then input the commands as suggested, and then the resource group is created as shown in the diagram below.

In the diagram below, after pressing enter, I wait for the prompt to return but it usually returns in JSON format Then I enter the command "az group list --output table" to see it in a more familiar format.

can also be seen in the diagram below on the Azure portal.

Now I am creating the app service plan that will house the computing, networking, etc. for the web app that I will be creating later in this article.

Just as I did previously, I typed the "az appservice create" and then pressed the enter key. This would let me know the parameters that I required to create the app service, as shown in the diagram.

In the diagram below you will see the provisioning state succeeded", meaning it has successfully created the app service, and then I used the list command to view it in table format.

Now it is time to create the web app I used the method I had previously used, as shown in the diagram below to get the commands to create a basic web app.

Then I used the list command in the cloud shell to view what I created, as shown in the diagram below.

Also shown below in the Azure portal.

In the diagram below in Azure portal is the web app I created.

In the diagram below, when you click on the default domain, it will redirect you the another page on the browser for you to see what you are hosting, which in my case is nothing for now.

Now that we are done, it is time to clean up.

  1. Show the resource groups created.

  2. Show me the parameters to input to delete the resource I want to delete.

  3. Shows I needed to add a resource group.

  4. I entered the command then pressed enter and waited for it.

In the diagram below, the prompt returned has already been executed successfully.

Evidence 1.

Evidence 2.

Then to delete the last resource group that Azure created for me when creating storage for the cloud shell, I use the power shell in my local PC, on which I have already installed Azure cli, as shown in the diagram below.

To install Azure cli on your local PC, click here

To learn more commands about app services and web apps, click here.

If you find this article useful, pls like it. Thanks very much