Deployment Slots In Azure Web Apps - Part One

Deployment slots are a separate site deployment having their own host name. Every time you are deploying a site, you are deploying it to a slot. By default, there is a production slot and it is possible to have five slots. Until you explicitly mention that you want to deploy in one specific slot, it will hold in the same slot , which is the production slot.

For those who are not in a corporate production environment, this means something that is live and being used by customer. In a corporate environment, you may not want to directly publish the changes in production, without testing and user acceptance.

There are multiple stages of testing such as quality assurance testing, user acceptance testing, and a staging environment. This is where the slots come into play you can create slots for different testing environments. You can even dedicate some slots for testing and deploy the app to it, which will be live and can be accessed only by those who know the exact URL.

I already have a website up and running which I published in the previous article via FTP. In the dashboard of the website, you can see the deployment slots section.

 

As the deployment slot capability is not available with the free shared and basic plan, we have to change the price tier either into standard or premium plan. On changing the plan back to the portal, you can see the option to add a slot. Click on "Add Slot" which will prompt the following window for the slot details.

 

Here, I have given the name as development. Now, it's asking whether I want to clone the configuration data from the production web app. I am selecting to do so and clicking on OK.

 

These slots are independent and do not talk to each other. Any changes that you make in one will not reflect in the other. Now, you can see that a new slot has been created and when you click on the new slot, you can get a new dashboard which looks like another website and has another URL with our domainname-development.azurewebsites.net.

 

However, you can’t see this slot as another website in the "all resources" section as it is still part of the main web app even though it works differently. When you click on the domain here, you see the default template as shown below.

 

Now, let us see how we can publish to our new slot. I am loading a Visual Studio project that I made in the previous article. I made a small change as “This is to deploy in development slot” in the body tag and I am going to publish it.

 

Click on "Publish" and select "Microsoft Web Apps" section again. Here, we can see that under existing web apps, there is a new item called development which is the slot we just created.

 

Select it and follow the publishing steps as before. Now, run the same. You will get a different page in the development slot and another in the production slot.

Up Next
    Ebook Download
    View all
    Learn
    View all