Creating Azure Web App using CLI
Published: 2023-07-02 08:02:28

in this blog spot we will create a web app in Azure using the command line interface.  According to  [Wikipedia](https://en.wikipedia.org/wiki/Azure_Web_Apps) definition ,azure web app is a cloud computing based platform for hosting websites, created and operated by Microsoft. It is platform as a service which allows publishing Web Apps running on multiple frameworks and written in different programming languages, including Microsoft propriety ones and 3rd party ones. 

 **Things Required**

1. Install Azure CLI
2. GitHub Account
3. Install Git Bash

**Follow the steps below to get started**

1. On your windows machine open PowerShell
2. To login into your Azure account type `az login`  and press ENTER

![webapp01](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e8ftbwc29bksjaril701.png)
3. Create A Resource group using the command 
`az group create --name ( group name) --location (region)`

![webapp06](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pxt5kzv9qrldlt3zald6.png)

4. Create a web app service plan using the command
`appservice plan create --name(plan name) --resource-group (resource group name)`

![webapp03](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q5z8ecte20q19bmtsnmv.png)
5. Create a web App next using the below command
`az webapp create --name (name of your webapp) --resource-group (resource group name) --plan (name of plan created already)`

![webapp04](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wa3utcbipy8pcpymjubv.png)

**STEPS TO DEPLOY WEB APP**
1. Go to your Git Hub account ,and click on the repository that contains your website files(HTML, CSS, JavaScript)
2. Click on the _Code_ and copy the URL,HTTPS is selected by default, copy it.

![webapp05](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w2f8r0fvwenilb6vpo5k.png)
3 Go back to PowerShell and type the following command

`az webapp deployment source config --name "webApp name" --resource-group "resource group name" --repo-url "url copied from GitHub" --branch "branch of the repo" --manual-integration`

![webapp06](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f1h7czznqc06wperjq25.png)
In this case we are using _webapp_ name of "pluralsite", _resource-group_ name "Buchiw", _repo-url_ "The copied url from your GitHub above", and _branch_ "master".

4. Go to your Azure portal and open your resource group, 
   then _App service plan_, 
   under **settings** select the _Apps_ .
   select and click the App created,"pluralsite".

![webapp07](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ilagwulxef30bn3g8k75.png)
The web app gives us an overview of

![webapp09](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nvsqp7l73dmepobiwwc9.png)
From the above created web app, label1 is the resource group containers where all the services and resource are stored, label2 is the default domain, the URL of your website and label3 is the Repository from GitHub. It holds every content of your websites.
Clicking on Deployment centre at rightside under Deployment gives you a summary of your entire page

![webapp10](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qs1f5wok3uos7tgkcvov.png)
We can also view our web page by copying and pasting the domain name on our browser.

![webapp11](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/caifxr27hfsi1awt4ryl.png)
SCALEUP AND SCALEOUT
Scalability is the ability to quickly and easily increase or decrease the size or power of an IT solution or [resources](https://azure.microsoft.com/en-in/resources/cloud-computing-dictionary/scaling-out-vs-scaling-up/#overview)
Vertical scaling or scaling up or down is used when we need to react quickly to fix performance issues that cannot be resolved using classic database optimization techniques. It involves adding more RAM and Storage.

Horizontal scaling or scaling out or in, it involves you adding more databases or divide your large database into small pieces using a partitioning technology called sharding. Sharding is separating different rows of information from table and storing them in different databases. It is used in most notably non-relational No SQL databases. It enables them to handle large indeterminate and rapidly changing data.

**STEPS TO SCALE UP**
1. Go to on app service plan, 
2. under settings click on scale up, choose a desired capacity from Production,  the next window shows you a confirmation window to confirm your selection.

![webapp12](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ywnln9f7nraipvayrsox.png)

![webapp13](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2x6el2bn5pp9cicfwuj8.png)

**SCALE OUT**
1. Go to the App service plan page,
2. Under setting select scale out.
In the Scale out, we have Pricing plan and Scaling options. In pricing plan you can select from a range of different prices. For Dev/Test(less demanding workload), you may pick from Free F1 to Basic B3, and for Production  
Standard S1 to Premium V2 P3V2.
On the scale out , we can choose manual, automatic or rule based.

In conclusion, as production increases and more and more traffics comes to our websites we will always need to scale up and scale out. I hope you were able to provision your web app following these steps.