Azure WebApp - Rollback Your Deployment Using Deployment Slot

We generally find issues in our deployed application while it is in production. This is a really awkward situation in the development cycle. It is also painful for the customer. I am going to discuss the solution to this issue in this article.

We generally find issues in our deployed application on a production server. This is a really awkward situation in the development cycle. It is also painful for the customer. I am going to discuss the solution to this issue.

The easy and the quickest solution is Rollback deployment. There is one of the important features provided in Azure is Deployment Slots. We can easily rollback the deployment using deployment slots. There are so many questions that may come to your mind about deployment slots. I am going to answer the common questions about deployment slots which will help you to understand the solution of the issue.

What is Deployment Slot?

It is the most important feature of Azure provided in App Service. We generally directly deploy the application on created web app on Azure. The default deployment is in production directly. It may be possible that we want to perform some activity or verification before deploying the website on production. For this situation, we can use deployment slots. For every web app, Azure provides four non-production deployment slots on which we can deploy the website. Every deployment slot provides a different URL to access the web app for the verification of the application.

What is the usage of Deployment Slots?

Deployment slots provide the option to deploy websites in other environments rather than deploying the website directly on production. It is possible that we want to perform some action before deployment of the website on production. In this case, instead of deployment of a website to production directly, we can deploy the website to other slots.

The deployment slots is useful in following scenarios,

  1. Staged Deployment
    In staged deployment, we deploy a website to a non-production slot that is acting as the staged environment. In this environment, we can test whether the website is working as expected. If the website is working properly as expected we can swap the production slot with staging slot.

  2. Incremental Deployment
    It may be possible that some of the activities to be performed after deployment. In that, we can deploy the website on a non-production slot. We can make perform activity required post-deployment and then swap with the production slot to make the updated website live.

  3. Rolling Back Deployment
    If after swapping a non-production slot into production, you need to roll back the deployment, you can swap the production slot again with the slot that contains the previous production content and configuration, thereby rolling back the deployment.

What are the key features of Deployment Slots?

Answer: Some of the important features of the deployment slots are discussed below:

  1. With each deployment slot, we can create up to four additional deployment slots. These slots are known as non-production slots. All can be exchanged with production slot.
  2. All deployment slots to a given website share the same web hosting plan.
  3. All deployment slots are created within same virtual machine instance.
  4. Since the same VM instance used for all slots, we cannot scale the non-production slot independently of the production slot. We can adjust only the settings of production slot.
  5. The website for which we want to create additional deployment slot must be using the standard web-hosting plan mode. We can’t create a deployment slot with the free, shared and basic modes.

Steps to create Deployment Slot

We can use the following steps to create the deployment slots.

Step 1

Navigate to the blade website in the portal accessed by

Step 2

Scroll to Deployment to click deployment slots.

Step 3

In the blade that appears, click "Add Slot".

Azure WebApp

Step 4

Provide the name of deployment slot. This name will be added as a suffix to the name used by existing slot. We can also choose an existing slot as the source from which to copy configuration settings to apply to the new deployment slot.

Azure WebApp

Step 5

Click ok to create new deployment slot.

We can deploy the website on the created deployment slot. We can get the publish profile for the deployment.

RollBack Deployment:

As we discussed earlier we can roll back the deployment of production in case any issue found on the deployed website on production.

There is an option to SWAPby using which we can roll back the deployment.

To rollback a deployment, select the production slot that represents the broken deployment, click swap, and for the destination, choose the slot that contains the deployment that was previously in the production slot.

Azure WebApp

Swapping and website configuration

It is important to know that when we swap deployment slots all the website content is swapped but this is not true with the configuration settings. The following website configuration got moved to destination slot,

  1. General settings (.net framework version, Web Sockets)
  2. Connection strings
  3. Handler Mappings
  4. Application and site diagnostic settings
  5. Monitoring settings.

The following website configuration items will not move to the destination slot.

  1. Publishing endpoints
  2. Custom Domain Names
  3. SSL certificates and bindings
  4. Scale settings


The database connection strings should be configured with the production values prior to the swap.