HOW TO USE AZURE CLI COMMANDS TO DEPOLOY WEB APP FROM GITHUB REPO TO AZURE
Published: 2023-06-23 11:47:30

Create a sample web app application in github repo, use the azure cli commands to deploy the web app content from github into azure porta i.e push the web app code from github to the deployment center of azure app service.

a.	On the githuB page click on create new repo, 

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

b.	Enter the repo name, give the repo a description, select public, initialize by checking add a README file, then click on create repo.

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

c.	Click on add-file to upload or create file html or php web files, index.php file added as shown below.

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

_**Create resource group, web app plan and web app using the azure cli commands **_

d.	Create the resource group using the command below, after az login in your powershell: AppServiceRG 
**az group create --name AppServiceRG --location eastus**

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

e.	Create an app plan using the command: appservicePlan
**az appservice plan create --name AppservicePlan --resource-group AppServiceRG**


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

f.	Create a web app using this command: Project10WebApp
**az webapp create --name Project10WebApp --resource-group AppServiceRG --plan AppServicePlan**


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

g.	On the azure portal are the AppServiceRG, AppServicePlan and the Project10WebApp we created using the commands. 


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


h.	Deploy code from a public GitHub repository using the command below
**az webapp deployment source config --name Project10WebApp --resource-group AppServiceRG --repo-url https://github.com/joseph4real/php-docs-hello-world --branch master --manual-integration**
**Note: the repo URL is from the githup repo.**


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

i.	Below are Pictures before deploying from github and after deploying form github, i.e. before running the deploy command and after running the deploy command.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ormzqipvx38s2z7fuiy.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2pa25kdseu8d1zoh1vfv.png)

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

**NOTE: After deploy, one can comfirm from the picture, the source as external git and github repo URL.**
J.	Run the web app you created by opening the ULR or click the browser button.

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

k.	Find the result below after opening the website.


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

**With the above blog I have successfully deployed my web app from github repo into my azure portal.**