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”
- 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.
- 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)
Publish Website to Slot:
- Use Visual studio “Publish Web” option
- Select “Microsoft Azure App Service” and choose your main “App Service” and “Deployment Slots -> {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
Swap Slot:
- Once you feel your slot is fine and can be promoted as main App
- Click on ‘Swap’
- Select ‘Source’ and ‘Destination’
- Main Web App would always represent as “production”
- “Staging’ is the name of your slot
- 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.
🙂
Categories: Azure, Uncategorized
Azure, Deployment Slot, No Down time, Swap
Comments (0)
Trackbacks (0)
Leave a comment
Trackback