How to deploy to Azure using Team Services Release Management

Introduction

Step 1: Create a new Build definition

Step 2: Create a Release definition

Step 3: Create an Azure Subscription

Step 4: Deploy an application

Step 5: Configure continuous delivery from the Azure portal

Step 6: Check the results

Conclusion


 

Introduction

This post will demonstrate how Azure deployments are made easy by using Visual Studio Team Services (VSTS) Release Management. You will see a step-by-step tutorial on how to configure and deploy to Azure in Release Management, and, moreover, how to configure an end-to-end pipeline for deploying applications on Azure.

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.

 

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.

    1. In your VSTS portal go to the Build & Release tab.
    2. In Build & Release tab choose Builds from the ribbon.
    3. Create new Build definition by clicking on +New.
    4. From the appeared list of templates for various applications, choose your application type. We will be using NET web application.
    5. Click on Next.

 

2. Create New Build Definition in VSTS

 

  1. Pick the Code Repository and the Branch for your Build definition.
  2. Click on Create.

 

3. Create New Build Definition - Repository Choice

 

  1. 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.
  2. Click on Save.
  3. Name your Build definition.
  4. Click OK.

 

4. Save Build definition

 

  1. Your Build definition is ready.
  2. Create a Build from the new Build definition by pressing Queue new build.
  3. Press OK.

 

5. Queue new build

 

Step 2: Create a Release definition

After the Build is successfully created – you will need to create a Release for it.

  1. 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.
  2. From the Build summary page click on Create release.
  3. Click Yes.

 

6. Create Release

 

  1. Choose an appropriate template from the appeared set of templates. In this case we will use the App Service Deployment.
  2. Click on Next.

 

7. Create Release - App service deployment

 

  1. The Source will be figured out automatically.
  2. Click on Create.

 

8. Create Release - Source

 

Step 3: Create an Azure Subscription

The deployment task will be created by default. Now, you need to create an endpoint subscription – the end point you want to deploy to.

  1. You will be automatically redirected to the Releases tab of your VSTS portal.
  2. 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.
  3. Name your subscription.
  4. Click OK.

 

9-10. New subscription

 

The end point 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.

  1. Pick a web application from App Service Name drop-down list. With this setting you are 100% ready to deploy.
  2. 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).
  3. Click on Clone environment. This will be your production environment.

 

11-12. App Service Name

 

  1. An Add new environment window will automatically opened.
  2. You can choose the desired parameters for the Pre-deployment approval and Trigger. In this case we will keep the default settings.
  3. Click on Create.

 

13. Add new environment

 

  1. 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>.
  2. Click on Save.
  3. Enter a Comment providing you with some information about the application.
  4. Click OK.

 

14-15. AzureRM Subscription

 

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.

  1. In the Azure portal your newly created application is already available. Open this application (in our case, the application is called <Contoso portal>).

 

16. Azure portal

 

  1. 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.
  2. Click Continue.

 

17. Continuous delivery

 

  1. The first step of configuring a continuous deliver is to provide the source parameters where the Source Code is available. Click on Source Code to configure repository.
  2. There is support for Visual Studio Team Services and GitHub. For this demo we will choose Visual Studio Team Services.
  3. 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.
  4. Choose the Project, the Repository and the Branch from the automatically created lists.
  5. Click OK. The source code is now configured.

 

18. Source Code

 

  1. Set up the application framework type, used to generate the Build. Click on Build.
  2. Choose the Web Application Framework. In our case it is an net application.
  3. Click OK.
  4. 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.

 

19. Application framework

 

  1. 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.
  2. Create a Staging Environment by pressing Yes under Create staging environments.
  3. 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.
  4. Click OK.
  5. Click OK in the Deployment Source section of the screen.

 

20. Deploy

 

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.

  1. Once the deployment is configured completely you can see the Build definitions, Release definitions and Release details.
  2. We will check the result of configuring the Release definition. Click on Release definitions.

 

21. Release definition

 

  1. A new tab will open with the Release definition that just got created based on the performed configuration. The Build link is available, where you can see the Build, the code and the work items that got added.

 

22. Release definition opened

 

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.

Share This: