This post will demonstrate how Azure deployments are easily made using Visual Studio Team Services (VSTS) Release Management. Below you will see a step-by-step tutorial on how to configure and deploy to Azure in Release Management, and also how to configure an end-to-end pipeline for deploying applications on Azure.
Introduction
Release Management (RM) is a DevOps feature set in both Team Foundation Services (TFS) and VSTS. The figure below demonstrates an example of VSTS Release Management portal interface.
RM allows you to set up a continuous delivery all the way from code check-ins to production through various test environments. This tutorial will show you how to get started easily using all the built-in templates and the tasks that are available in Build and Release, get connected to Azure with a single click, and configure continuous delivery to Azure.
Step 1: Create a new Build definition
VSTS is a Microsoft-provided cloud infrastructure with an integrated set of services allowing to plan, build, and ship software across a variety of platforms, without having to install or configure a single server. In this step, you will see how to create a Build definition template that you will deploy to Azure in the next steps.
- In your VSTS portal go to the Build & Release tab.
- In Build & Release tab choose Builds from the ribbon.
- Create new Build definition by clicking on +New.
- From the appeared list of templates for various applications, choose your application type. We will be using NET web application.
- Click on Next.
- Pick the Code Repository and the Branch for your Build definition.
- Click on Create.
- As soon as you create the template, all the tasks with already pre-set right parameters will be created by default. You don’t need to change a single value – the build packages automatically create the web packages needed to deploy.
- Click on Save.
- Name your Build definition.
- Click OK.
- Your Build definition is ready.
- Create a Build from the new Build definition by pressing Queue new build.
- Press OK.
Step 2: Create a Release definition
After the Build is successfully created, you will need to create a Release for it.
- When the Build is created you will be automatically redirected to the Build summary page, where you can see Build successful indication on top of the page.
- From the Build, summary page click on Create release.
- Click Yes.
- Choose an appropriate template from the appeared set of templates. In this case, we will use the App Service Deployment.
- Click on Next.
- The Source will be figured out automatically.
- Click on Create.
Step 3: Create an Azure Subscription
The deployment task will be created by default. Now, you need to create an endpoint subscription – the endpoint you want to deploy to.
- You will be automatically redirected to the Releases tab of your VSTS portal.
- Click on Add in the Deploy Azure App Service area to create a new subscription. Based on the logged-in user, the system will automatically figure out the available subscriptions on Azure.
- Name your subscription.
- Click OK.
The endpoint is now created and you can continue with the task.
Step 4: Deploy an application
All the applications from your Azure subscription will be available for deployment. In this tutorial we will simply choose an available application from the list; however, there are Additional Deployment Options available for advanced users. The application can be configured as a Web Deploy, additional SetParameters File can be set up, and the application can even be taken offline. For the simple scenario described in this tutorial, these additional parameters are not required.
- Pick a web application from App Service Name drop-down list. With this setting, you are 100% ready to deploy.
- Now you need to create a new production environment. In this case, we will simply Clone an environment. Click on the ellipsis ··· symbol next to your existing Environment (<Environment 1> in our case).
- Click on Clone environment. This will be your production environment.
- An Add new environment window will automatically open.
- You can choose the desired parameters for the Pre-deployment approval and Trigger. In this case, we will keep the default settings.
- Click on Create.
- In the Deploy Azure App Service section choose a subscription that you want to use for your production from the Azure RM subscriptions dropdown list. In this case, we will choose <AzureAppSub>.
- Click on Save.
- Enter a Comment providing you with some information about the application.
- Click OK.
The deployment process is now finished. Visual Studio RM has the best DevOps deployment experience for Azure. It provides with a single click Azure connection to deploy to Azure. Furthermore, you can deploy applications to Azure using Visual Studio Team Services Release Management portal and you can configure the continuous delivery from the Azure portal as well.
Step 5: Configure continuous delivery from the Azure portal
Continuous delivery provides you with an automated way of building, testing and deploying to Azure. If needed, you can also configure manual approvals; therefore, continuous delivery essentially allows you to deploy with confidence.
- In the Azure portal, your newly created application is already available. Open this application (in our case, the application is called <Contoso portal>).
- You will see a new item in the portal called Continuous delivery. Click on it. Using this item, you can configure continuous delivery for every Azure web application.
- Click Continue.
- The first step of configuring a continuous delivery is to provide the source parameters where the Source Code is available. Click on Source Code to configure repository.
- There is support for Visual Studio Team Services and GitHub. For this demo, we will choose Visual Studio Team Services.
- As soon as you choose VSTS, based on the logged in identity Azure will automatically show you all the accounts associated with your identity. Choose the Account where your source code is available; you will not be prompted to enter any username or password.
- Choose the Project, the Repository and the Branch from the automatically created lists.
- Click OK. The source code is now configured.
- Set up the application framework type, used to generate the Build. Click on Build.
- Choose the Web Application Framework. In our case, it is a net application.
- Click OK.
- If needed, you can configure the Test environment allowing you to add all the load testing targeting this application. For this tutorial, we will skip this step.
- The last step for continuous delivery configuration is publishing to production. We always recommend using Slots: deploying the application first to the Slot and then swapping it to production. Click on Deploy to configure publishing to production.
- Create a Staging Environment by pressing Yes under Create staging environments.
- Within the environment, you can make use of an already created Deployment Slot, or even create a new Slot. For this tutorial, we will use an existing <staging> Slot.
- Click OK.
- Click OK in the Deployment Source section of the screen.
Step 6: Check the results
Your Build definition and your Release definition are now completely configured for doing automated deployments to your Azure web application.
- Once the deployment is configured completely you can see the Build definitions, Release definitions and Release details.
- We will check the result of configuring the Release definition. Click on Release definitions.
- A new tab will open with the Release definition that just got created based on the preformed configuration. The Build link is available, where you can see the Build, the code and the work items that got added.
Conclusion
This tutorial has demonstrated how to configure and deploy to Azure in Release Management, and how to configure an end-to-end pipeline for deploying applications on Azure. Visual Studio Team Services have the best Integration Story for DevOps deployment between Azure and Release Management.
If you have not used Release Management, – you can give it a try for free by creating a Visual Studio Team Services account.
This post was originally published on mohamedradwan.com at How to deploy to Azure using Team Services Release Management