DEV Community

joseph4real
joseph4real

Posted on

HOW TO USE AZURE CLI COMMANDS TO DEPOLOY WEB APP FROM GITHUB REPO TO AZURE

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

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

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

Image description

*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

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

Image description

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

Image description

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

Image description

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

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

Image description

Image description

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

k. Find the result below after opening the website.

Image description

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

Top comments (0)