Azure App Service - Deployment Slot

Azure makes it easy, to create deployment slots for App Services. It’s available in the Standard or Premium App Service plan mode. Deployment slots are actually live apps with their own hostnames. App content and configurations elements can be swapped between two deployment slots, including the production slot.

Overview

  • Introduction
  • How to create
  • How to swap
  • Conclusion
  • References

Introduction

Azure makes it easy to create deployment slots for App Services. It’s available in the Standard or Premium App Service plan mode. Deployment slots are actually live apps with their own hostnames. App content and configuration elements can be swapped between two deployment slots, including the production slot.

Azure

Azure customers can easily perform the following steps

  1. Deploy the web application to an online deployment slot.
  2. Run the tests on a deployment slot, within the live environment that potential testers are going to use. Testing environment and production environment exist side-by-side and provide the similar environment.
  3. Perform an internal swapping of the IP addresses of both slots (via load balancing and traffic management for both the nodes — slots)
  4. Update applications with zero downtime
  5. Swap back to a previous version of your app instantly, with zero downtime for users.

How to create

Step 1

Go to Azure portal, open your App Service. Click on Deployment Slot  - Add Slot.

Azure

Step 2

Write a name for slot – if you name it as staging, you can access that using -

yourappname-staging. azurewebsites.net

Azure

Step 3

Slot created successfully. You can get its publish profile and publish new changes on the slot.

Azure

Azure

How to swap

Step 1

Go to the Azure portal >> slot. Now, click on Swap.

Azure

Step 2

Choose source and destination slot and click OK. After some time, you will get a notification “Swap operation completed successfully”.

Azure

Conclusion

The overall reason to have deployment slots enabled is that it helps your team to run live testing on the production environment, and in case there are some problems on the production slot, it lets you roll back the swap without having to take your application down for maintenance.

References

https://docs.microsoft.com/en-us/azure/app-service-web/web-sites-staged-publishing