Azure App Service : Swap with Preview

Developer Support

In this post, Senior Application Development Manager, Nayan Patel, spotlights App Service deployment using Swap with Preview


I was recently assisting a customer with an App Service deployment problem in Azure and came across a fairly new feature (Swap with Preview) that addressed the customer need.  App Services offer multiple deployment slots which effectively provides a way to have multiple versions of code deployed and capability to quickly alternate (or swap) between them.  This is very useful and generally used to test new code in a Staging slot before it is swapped to the Production slot and goes live.

To do this, you can create an additional deployment slot (staging, for example) off the main production slot which sets up a completely separate app with its own AppSettings, ConnectionStrings and Git deployment URL.  Typically, you deploy new code to the staging slot along with staged app settings and connection strings to test the app.  Once you are ready to push this deployment to production you simply swap the staging slot to production slot.  However, in many cases, applications encounter issues when production AppSettings and ConnectionStrings get applied after the swap and when the app goes live.

Swap with Preview allows you to validate the app with production configuration before the app is swapped into production. You can pick the option on the Azure portal as show below:

Here are some benefits of using Swap with Preview

  • Ability use production configuration settings in staging slot and test the app exactly how it would behave in production before going live
  • When configuration settings are applied in the staging slot, it restarts the worker process and you can execute warmup scripts or tests to ensure the app is healthy
  • After verifying the app in staging, it uses the same warmed-up worker process when you swap to production, which reduces any startup downtime or performance overhead associated with the app spinning up
  • If testing is not successful, you can cancel the swap and it will reapply all the configuration settings of the staging slot again

 

For more information, see Setup staging environments in Azure App Services and Slot Swap with Preview.


Premier Support for Developers provides strategic technology guidance, critical support coverage, and a range of essential services to help teams optimize development lifecycles and improve software quality.  Contact your Application Development Manager (ADM) or email us to learn more about what we can do for you.

0 comments

Discussion is closed.

Feedback usabilla icon