Oct 06 2020 09:02 AM - edited Oct 06 2020 09:10 AM
Start the CloudShell in the Azure portal
or go to the following URL: https://shell.azure.com/
Please start with these steps:
#Here you can find out which subscription you are working with
az account show
#View all subscriptions
az account list --all --output table
#change the subscription (if necessary)
az account set --subscription "Name of the Subscription"
#Replace the following URL with a public GitHub repo URL (or use the following)
gitrepo=https://github.com/Azure-Samples/php-docs-hello-world
webappname=mywebapp$RANDOM
#Create a resource group.
az group create --location westeurope --name myResourceGroup
#Create an App Service plan in STANDARD tier (minimum required by deployment slots).
az appservice plan create --name $webappname --resource-group myResourceGroup --sku S1
#Create a web app.
az webapp create --name $webappname --resource-group myResourceGroup --plan $webappname
#Create a deployment slot with the name "staging".
az webapp deployment slot create --name $webappname --resource-group myResourceGroup --slot staging
#Deploy sample code to "staging" slot from GitHub.
az webapp deployment source config --name $webappname --resource-group myResourceGroup --slot staging --repo-url $gitrepo --branch master --manual-integration
#Copy the result of the following command into a browser to see the staging slot.
echo http://$webappname-staging.azurewebsites.net
#Swap the verified/warmed up staging slot into production.
az webapp deployment slot swap --name $webappname --resource-group myResourceGroup --slot staging
#Copy the result of the following command into a browser to see the web app in the production slot.
echo http://$webappname.azurewebsites.net
#Clean Up (if necessary)
az group delete --name myResourceGroup --yes
I hope you have gained an insight into how you can deploy a web application and a deployment slot with the Azure CLI. Best regards, Tom Wechsler