In November, Microsoft announced the preview of Release Management as part of Visual Studio Online. This capability allows teams to easily configure automated continuous deployments to virtual machines running in Azure, aligning to the Infrastructure-as-a-Service (IaaS) cloud computing model. While there are many benefits to leveraging Azure for IaaS deployments, greater agility and savings can be realized via other cloud models and Azure services beyond virtual machines. Platform-as-a-Service (PasS) computing models relieve customers of management and operational activities - including patching, operating system updates, etc. – while providing the same application platform capabilities as traditional virtual machines and IaaS environments. Teams that transition solutions to platform-based services can achieve greater agility, lower operational overhead and lower costs while continuing to employ continuous delivery practices.
So how can Visual Studio Online enable Continuous Deployment to Azure PaaS environments?
The Release Management team announced earlier this month that formal support for PaaS environments, including Azure Web Sites and Cloud Services, is in the works; however, that does not mean we cannot target them today. Before Release Management in Visual Studio Online, teams had two options: deployment from within Visual Studio via the MSDeploy/Publish functionality and the continuous deployment build process template in Visual Studio Online. Microsoft also released the Azure Resource Manager Tools for Visual Studio 2013, which provides new project templates and base scripts for enabling deployment to Microsoft Azure. With Release Management, teams and organizations benefit from developing a release strategy that maintains configuration consistency across environment, aligns with their promotion workflow processes and approval automation. Let's take a look at how these options align with Release Management.
Publish from Visual Studio
With Web Application projects, developers can easily associate their applications with an Azure subscription and manage the publish settings associated with a targeted Azure Web Site. You can also leverage the Azure Cloud Services project template to deploy applications to Azure Web Roles in a Cloud Service. Both Cloud Services and Azure Web Sites represent two different PaaS deployment models and Visual Studio allows developers to publish their applications directly to these environments. While this is a great feature for enabling developers to quickly build and test locally on Azure, it bypasses build automation and release management practices that viewed as industry best practices. Configuration settings that typically vary based on target environment also are not centrally managed but placed in the hands of developers – something that most organizations do not allow. So, while publishing directly from Visual Studio looks and sounds great as a developer, these options do not align with best practices.
Team Build Continuous Deployment
The Azure and Visual Studio teams partnered months ago to alleviate the first problem that we discussed when publishing to Azure from Visual Studio: automated builds are bypassed. With Visual Studio Online, the continuous deployment build process template allows teams to continue leverage continuous integration practices (running tests during build, gate code commits based on quality, etc.) and, upon successful build, deploy directly to Azure. The mechanism is very similar to that of publishing from Visual Studio, however, it occurs as part of the build process. This takes us one step further to release management, however, configuration management, deployment automation (beyond that which can happen as part of MSDeploy) and process approvals and automation are all missing.
Cloud Deployment Projects and Azure Resource Manager
Cloud Deployment Projects are new to Visual Studio beginning with the Microsoft Azure SDK release in mid-2014 and updated again in November 2014. These projects leverage Azure Resource Manager templates to define the Azure resources (web sites, SQL Databases, storage accounts, etc.) required for the application and the configuration settings for each resource. The templates also allow you to define parameters or variables so that settings can be provided at runtime. A basic PowerShell script is provided as an example of how to use the template to provision resources and deploy your application. Since these artifacts are used to describe our environment and infrastructure resources as code, we can include them in our standard build processes and make use of the as part of our release strategy.
Now that we have an understanding of our Azure deployment options, how can we leverage them with Visual Studio Online and its Release Management service? Today, because the Release Management service can only target Azure virtual machines, we need still need a virtual machine to act as our "target". The output of the build process will be copied to this virtual machine and Release Management will invoke our PowerShell script on it, which will provision and deploy our application to Azure. This provides several benefits:
- It allows for environment or stage-specific configuration settings to be provided at deployment time via token replacements, etc.
- Since we're leveraging Release Management, workflows and other process automation activities are not circumvented
- Operations can maintain sensitive settings such as target Azure Subscription information, connection strings and other credentials
- Even though we are not targeting virtual machines/IaaS deployment scenarios, this virtual machine could provide other useful capabilities such automated functional test execution using Microsoft Test Manager, etc. so while it seems unnecessary there are other ways it can be advantageous
With an understanding of options available for implementing continuous deployment to PaaS environments in Azure, in my next post I'll walk through an example of how to deploy a web application to Azure Web Sites using Visual Studio Online Release Management and Cloud Deployment Projects.