Use the Azure CLI to provide a web app in Azure with a deployment slot



Start the CloudShell in the Azure portal


or go to the following URL:


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)


#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://$


#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://$


#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




0 Replies