Welcome to another article on Microsoft Azure App Services. I hope you enjoyed my previous article, which was an introductory article that helped us build Azure App Service.
In this article, we will deploy a web application to our Web Application Service environment and show you how you can do it.
Before we dive into each type of deployment, we need to remember that even if we don’t need to manage the back-end infrastructure for App Service, we still need to deploy our web application to IIS servers that are hosted in Azure.
There are several ways to deploy a web application to Azure: FTP Transfer, Web Deploy with Visual Studio and Kudu. Kudu is a continuous deployment tool that integrates with your GitHub, Bitbucket, and more. It automatically updates your web app code to Azure every time you commit code to GitHub, Bitbucket, etc.
The next item we’ll talk about is deployment slots. When you create an Azure App Service, you have one deployment slot, called the production slot, which is directly linked to the Azure URL that was created when the App Service was created.
You can have multiple slots for testing, staging, etc., but the web application that will be presented to the world will be the same as in the production slot. For example, to change the slots for production and staging, you can switch between them.
This way the production slot becomes staging and the staging slot becomes production when you are ready to deploy. The exchange takes a second and does not cause downtime.
Create a deployment slot in Azure Application Services
Now let’s create some slots. First, in the deployment section, we click on the deployment slots.
Then we click on Add Slot.
Give the slot a name. In this example, we’ll call the slot staging. The full slot name will now be mylabwebapp-staging.
As you can see below, we now have an intermediate slot created and running.
Now let’s visit the staging slot URL in our browser. The URL will be the original application name plus the slot name in our case in between.
If all goes to plan, we will see the following website.
Awesome! Now the last thing we’re going to do is replace the intermediate slot with a working one. To do this, we click on the slot and then click on “Exchange”.
Then we select the production and target slots. In our case, the Source slot is production, and the destination slot is intermediate.
Then click OK and that’s it. I hope this article was helpful and look forward to more articles on Microsoft Azure. Enjoy!