Azure App Service Deployment Slots

 

With the Standard App Service service plan upwards you get 5 Deployment slots to play with. These are essentially staging slots that can be used to progress from Dev to Pre-Prod to Live. There’s lots of guidance online about deployment slots but here’s my personal experience and headlines…. 

1. Add new deployment slot name accordingly (i.e “Pre-Prod” or “UAT”).
2. When prompted select the “Clone” option to clone all existing settings from your Production App Service.
3. You now have a self contained instance of a site with a separate Azure url.
4. Change Application Settings from Production accordingly.  Any settings that are only specific to that slot need to be ticked as a “Slot Setting” and changed with the deployment slot setting value.
5. Download the Publish Profile.  Should any developers here have the Production publish settings they can now be blown away from any local dev environments.   Obviously being a quality developer, you won’t have pushed these up to Source Control right!.
6. Fire up VS then Build and Deploy site using new Publish Profile. (This step should be automated – see below).
7. Check your new deployment slot site url and wave at your site.

Your New Route To Live/Production Deployment

Click “Swap” to swap deployment slots from Pre-Prod to Production. You can always switch back should you need to (if you’ve configured correctly and tested!).

One Click Deployment?

The above used in conjunction with a one click deployment script gives you a very quick and simple route to Pre-Prod then an even quicker deployment to Production. App Service deployments now take seconds.  In a further blog post I intend to outline how Powershell can be used to interact with Azure’s APIs.

Custom Domains?

As mentioned in point 3 above, each deployment slot is a self contained instance of a site.  Therefore, you can assign it a custom domain just as you would with the production site.  Once you’ve assign your domain’s CName and confirmed tie the domain up in Azure by navigating to your deployment slot, heading to “Custom Domains and SSL” and enter the custom domain you intend to use (i.e www.uat-mysite.com).  There’s no propagation to worry about here and domain should be allocated in seconds.

 

Leave a Reply