In Azure Resource Manager ARM Templates, you describe all the resources needed for your project. One of which could be an Azure App Service. For Azure App Services you can add an MSDeploy Resource, that describes what to publish to the app service. You could also define App Settings, Site Configurations, Connection Strings and many more. For more information about ARM Templates please visit the documentation here https://azure.microsoft.com/en-us/documentation/articles/resource-group-authoring-templates/.
In this post I will touch upon a scenario that might disrupt the flow of a template when dealing with an App Service, MSDeploy with other App configs (App Settings, Site Configurations, or Connection Strings). There are 2 manifestations of the problem:
1- An error from MSDeploy, something like "Deployment was interrupted and the process running it was terminated unexpectedly,..."
2- The deployment hangs and takes a lot of time to fail.
The reason behind this problem is a race condition caused by how the resources are ordered. App Settings changes or connection string changes cause a site restart Asynchronously, if MSDeploy goes after that step, then there is no guarantee that the site will not restart during the deployment. But if you make all steps depend on MSDeploy then you ensure MSDeploy runs first and then any other site restarting activities.
A working example of WordPress deployment template that is implementing this could be found here