Microsoft_Azure_Guide.MD
October 6, 2020 ยท View on GitHub
Microsoft Azure Deployment Guide
-
Visit Azure Portal.
-
Log in with your Microsoft Account [ Create one using LinkedIn or GitHub if you do not have it)
-
Click on terminal icon on the top right to open Azure Cloud Shell
-
Intialize your shell environment. [ I prefer going with
Bashbut I guessPowershellwould work just fine too] -
Select your subscription [ Google a bit to figure out how to get a free trial subscription for 12 months or a Azure Students Subscription]
-
Give it some seconds to mount to memory
-
If you are not logged in already, type
az loginand provide your credentials -
Now lets create a Resource Group for our Container Registry and Web App Service with the name say
your-projectand select the East US server (This works fine usually but for more details please have a look at the documentation on how to select the location)az group create --name your-project-RG --location eastus -
Cool! Now we need to build our Container Registry with the name say
your-project-RGand standardbasicwith admin access enabled inside the resource groupaz acr create --name your-project-registry --resource-group your-project-RG --sku basic --admin-enabled true -
Let's fetch our source code using git
git clone https://github.com/yourusername/your-project-repo-name.git -
Checking what we got
ls -aH -
Navigating inside our source folder
cd your-project-name -
Send the contents of this directory to Azure Container Registry which uses our Dockerfile to build the image and store it
az acr build --registry your-project-registry --resource-group your-project-RG --image your-project-name . -
Give this a couple of minutes
-
Create an App Service Plan for the web app
az appservice plan create --resource-group your-project-RG --name your-project-SP --location eastus --is-linux --sku B1 -
Now,we shall finally create our web app from the Docker container in the Azure Container Registry
az webapp create --name your-project-name --resource-group your-project-RG --plan your-project-SP --image your-project-registry.azurecr.io/your-project-name:latest
-
To redeploy the webapp
az acr build --registry your-project-regitry --resource-group your-project-RG --image your-project-name