HOW TO CREATE A WEB APPLICATIONS USING AZURE CLI: Step-by-Step Guide.
Tags: hagital, webdev, cloudcomputing, azure
Published: 2024-03-14 04:53:45

In this article, you will learn how to implement Azure CLI command lines to build ,deploy and scale web app and API.
The followings are the prerequisites that must be enabled on your system.
Prerequisites 
A Microsoft Azure Account with Active Subscriptions.
Azure CLI installed on your computer.

**Follow these steps to create an Azure App Service using Azure CLI
1. Login to Azure Account from Windows powershell on your computer by typing AZ LOGIN and press enter as demonstrated below

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4gty18ekklz579fnp3og.PNG)

Launching this command will definately redirect you to a web page requesting you to select an active microsoft azure account

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bzbqknlkw8twvhhtnckv.PNG)
Upon successful login , you will be asked to close the web page and continue to the powershell page where you will see the detail login to your azure account


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qs8u079ioheyvu5btjr5.PNG)

You will receive the below replies upon successful login

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ozwpqleez7f808955ul0.png)
2. Create a resource group
This resource group will house your web app(s) and other resources put together in creating you app.
The syntax for creating a resource group

az group create --name <resource-group-name> --location <location>

Once you issue the command line ,an instant copy of the resource group is created in Azure which comes with an instant reply in the CLI with message "Succeeded"

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i1uzxmmqvryd07qon7lt.PNG)
3. Create an app service plan
App service plan is more like an operating system that hosts your web application that provides the infrastructure and resources required to run, or scale your apps.
The syntax for this command 

az appservice plan create --name <app-service-plan-name> --resource-group <resource-group-name> 
Launching the command line below 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/88ga5unsjuxghjefmbc5.PNG)
You will receive a succeed message indicating that you service plan has been created.
4. Create your webb app
The syntax to creating a web application 

az webapp create --name <app-service-name> --resource-group <resource-group-name> --plan <app-service-plan-name>


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9buom1m0x9mnic186o9r.PNG)

5. Verify that the app service create is running
two way to verify that your app is running are
  1. CLI Command
     az webapp show --name <app-service-name> --resource-group 
     <resource-group-name>
  2. Login into Microsoft Azure account where the service are created.

we successfully create an Azure App Service lekewebapp using Azure CLI. With Azure App Service, you can easily deploy and scale your web apps and APIs in the cloud
Before you can deploy this app, we must configure a deployment for the app  just created and create a PUSH.
All these can be achieve in GITHUB.
Ensure you create an account with GITHUB.
created a repository and an index file for your web application. Your index file must have been created using Git BASH and push to GITHUB. This is yet another prerequisite to creating a web application done by a developer.
After successful creation of a repository, go to the code section,Copy the URL of the code .

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lfgpew90pfntqvdzxhn8.PNG)

6 Configure The Deployment Source of Your Web Application
The syntax to deploy your app 

az webapp deployment source config --name <name of your web app> --resource-group <name of your resource group> --repo-url <the HTTPS URL of the web app repo that contains your index file> --branch master --manual-integration

Lets go ahead and launch the deployment 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/274zms7308cu5je3k0f9.PNG)
You will get a feedbacks below upon successful deployment

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8m41ca9sc56y4ncb2gue.PNG)


![Image description](https://dev-to-
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nluv2w0gh3w2tlxpajam.PNG)

All Messages displayed while creating your web app can be viewed here
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/60twdob3k5ivzb156shj.PNG)

A deployment slot is a version of your web App that developer/cloud engineers use to test and make changes before deploying them to your production environment.

Cloud engineers uses deployment slot to add new features to there website without causing any downtime.

a) To create a deployment slot, go to your Web App page and scroll down to the left. Click on the deployment slot.

b) On the deployment slot page, we can see that our web app is in the production state running. The traffic is also 100%

c) To add a slot, click on +add slot 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xqkc0krjisd3s8jq4pzy.PNG)