Introduction
Deployment slots in Azure App Service enable zero-downtime updates and risk-free testing by providing isolated staging environments that mirror your production app. In this guide, you’ll learn how to:
- Create deployment slots (and upgrade your App Service plan when needed)
- Deploy changes to a staging slot for validation
- Swap slots seamlessly to promote tested code to production
- Verify the swap while maintaining rollback capability
- Perfect for CI/CD pipelines or manual deployments, this approach minimizes downtime and ensures smoother releases. Let’s dive in!
Requirements
- You must have completed Getting Started with Azure App Service: Deploy a Web App in Minutes
Configure Deployment Slot
- Open your Azure App services and select Deployment Slot under Deployment section.
- Since deployment slot is not supported by shared service plan, it will ask you to upgrade to standard or premium.
- Click upgrade, choose standard S1 and click on Select
- Click Upgrade
- Go back to deployment and click Add slot
- Choose a name for your slot which will serve as a unique url for your slot. Click Add after
- Confirm that the slot is created
- Open the slot by clicking on it. Click the Default Domain of the staging slot to check if it is running.
- You need to push your development code to this staging slot and see how you can swap it with the production after testing.
- Head over to VS Code and make some changes to the index.html file. I added version 2.0 to distinguish it from the production slot
- Next is to deploy it to slot by clicking view and select command pallete. Repeat the steps used to deploy the production slot
- Search and select Deploy to slot
- After deployment is succeeded, go back to the browser and click on refresh.
Swap deployment Slot
This allow seamless transition between production and staging environment
- Go back to your production slot and click on swap.
- Leave the settings as default and click start swap and wait for the swap to finish.
- To check if the swap works, go to your production Default Domain and it should display app with version 2.0
- Staging will display app without version 2.0
Thanks for staying till the end
Top comments (0)