Home > Azure, Uncategorized > Azure Deployment Slots – Deploy and Swap

Azure Deployment Slots – Deploy and Swap

Assume that you have your live application deployed on Azure running and you must deploy a hot fix.

The option you got is, you might want to take your application down for some time till your hot fix deployed.

How about you deploy the hot fix with no downtime, the answer is Azure “Deployment Slots”.

Create a Deployment Slot:

To use ‘Deployment Slots’, make sure you are running with Standard or Premium Azure Service Plan before adding a slot

  • Connect to Azure subscription and open your existing ‘App Service’
  • Under ‘DEPLOYMENT’ section, select ‘Deployment Slots’ and click on “Add Slot”

Azure - Deployment Slot

  • In the next screen, provide Slot name and choose ‘Configuration Source’. I gave my Slot name ‘Staging’ and in the ‘Configuration Source’:
    • If you choose your existing ‘App service’ all the settings including ‘Application Settings/Diagnostic Settings/…’ will be copied to this slot
    • Or you can choose ‘Don’t clone configuration….’ Option, if you want your slot to be clean and no carry over settings.

Deployment Slot - Add

  • Click ‘Ok’
  • After few seconds, you would get notification that your slot is ready
  • Once slot setup completed, your main App name will come as prefix of your slot (Ex: If ABC is my web app; my Slot name is ABC-staging)

Deployment Slot - Created

Publish Website to Slot:

  • Use Visual studio “Publish Web” option

Deploy - Connect Azure App Service

  • Select “Microsoft Azure App Service” and choose your main “App Service” and “Deployment Slots -> {Slot}”

Deploy - Slot

  • Click “Publish”
  • After publishing, your slot would work as any other Web App. You can give the slot URL to test to run BVT

Deployment Slot - Open Staging

Swap Slot:

  • Once you feel your slot is fine and can be promoted as main App
  • Click on ‘Swap’

Swap - 1

  • Select ‘Source’ and ‘Destination’
    • Main Web App would always represent as “production”
    • “Staging’ is the name of your slot

Swap - 2.PNG

  • Click Ok
  • It would take couple of minutes to complete Swap
  • Once Swap completes, end users who are accessing would start getting new build with virtually no down time.

Useful points:

  • If any errors are identified in production after a slot swap, roll the slots back to their pre-swap states by swapping the same two slots immediately
  • You can check your available ‘Deployment Slots’ by opening your Service Plans.

Check you available Slots.PNG

 

 

 

🙂

Advertisement
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: