What is the best practice to enable maintenance page in Sitecore Azure PaaS webapp? Also is there a way we can switch on maintenance page such as app_offline in application settings. I m looking at more automated way that can just save time without using option such as FTP publish or Kudu changes.
Using Maintenance Slots to Eliminate Deployment Downtime
Rather than use a maintenance page, you can actually avoid downtime in Azure by using multiple deployment slots. Think of this kind of like Content Search indexes with Solr or Lucene, using SwitchOnRebuild. Basically, you have (at least) two slots: one for your live site and another for a maintenance site that is essentially an exact duplicate of production. When you go to deploy, you deploy to the "maintenance slot", leaving the site in the "production slot" untouched and unaffected. Once the deployment is complete, you can start the maintenance site, thus initializing it so that it runs without any slowdown and once ready you can swap it with the site in the production slot. You would then update the site that was formerly in the production slot so that it matches what is now in production.
Adding in Support for a Rollback Plan
Improving upon this, you could use three slots to provide the ability to immediately rollback if the situation calls for it. To do so, you would deploy to two maintenance slots, warm one up for production and upon swapping the warmed maintenance site in you would leave the site that was formerly in the production slot (now swapped out) as-is. This means that if an issue occurs, you can quickly swap the old production site - still unmodified - back in to effectively roll back the deployment.
Tamas Varga deserves much of the credit for this post, including the additional references.
- Read about zero downtime deployment by Bas Lijten: http://blog.baslijten.com/zero-downtime-deployments-with-sitecore-on-azure/
- Read about Blue-Green deployment on Azure by Rob Habraken: https://www.robhabraken.nl/index.php/2740/blue-green-sitecore-deployments-on-azure/