Deployment slots are a feature of Azure App Services, and can be used with Web Apps, API Apps, and Mobile Apps. Whatever your application type is (i.e. web application, web api, or a mobile app backend), Deployment Slots allow you to set up environments other than that of the production environment (like the one we setup implicitly in the previous article). This means you can for example setup a test environment and a staging environment; something which you traditionally have done in on premise development.
Go again to the Azure portal and create a staging deployment slot as follows. Here I create a slot with name staging, which will automatically create a web app under the name [originalwebappname]-staging; in my case myblogwebapp-staging:
Once done, you will have your staging slot ready:
Now go to VS and do any change on your web application; I did the following impressive change:
Now deploy the web application to the staging slot – as we did before using the Publish wizard. Only this time you will see the slot we created within Azure portal:
Upon deployment completion, you will have a brand new Web App holding your staging web application:
Finally, you can swap the staging and production Web Apps using the portal:
Once you do you will notice that the versions have flipped. Note though that behind the scenes Swap doesn’t really move files from one place to another, what it actually does is swapping the VIPs assigned to the slots. This makes swapping a very fast process. This also means that if for whatever reason we find a production problem, we can swap back to the previous version as Azure again just swaps back the VIPs.
Finally, although I said it before but it’s important to stress this: a deployment slot is just another Web App, meaning that it falls under the pricing model.
In the next article, I’m going to talk about API Apps.