Thursday 11 May 2017

Auto Generating CD Build/Release Pipeline Targeting Azure App Service for MVC Web Application

VSTS allows great flexibility with it’s new web based build and release management features. You have several templates which can be used to create build and release definitions you need quickly. Lots of out of the box tasks allow you to further customize your definitions to support the steps that you need to perform during a build or a deployment. Visual Studio Marketplace is getting more and more components added to it, allowing you to find a task for almost any build deploy step you may require to perform. Taking the steps to the next level, you can now even generate your build/release pipeline with Visual Studio 2017, after adding the extension Continuous Delivery Tools for Visual Studio.

Let’s walkthrough the steps of generating a CD pipeline for an MVC Web Application, to allow it to be deployed to Azure App Service.

01. Create a Team Service, team project with repository selected as GIt or add a new Git repository to an existing team project.image

02. In Visual Studio 2017 clone the repository.image

03. Create a new Visual Studio solution.image

04. Add a new MVC Web Application project to the solution. image

05. Commit the changes to repository and push.image

07. Download and install Continuous Delivery Tools for Visual Studio. This will add an option to generate CD pipeline targeting Azure, in Visual Studio.image

08. In the popup window you can see the repository and branch selected to use the code base. If you care logged in with a Microsoft account having an Azure subscription it will be shown as target. You can add a different Microsoft account as well by clicking the drop down for User account field.image

09. Click Edit on above screen will let you modify target App Service App Name, Service Plan, Location and Resource Group.image

10. Select the preferences and click OK in  Configure Continuous Delivery window will create an Azure App Service App and configure a CD pipeline. Then will queue a build, once complete will trigger a release/deployment to the created Azure App Service App.image

11. You can view the build definition created in the Team Services project and edit it.image
12. You can see a build is already queued and completed and a deployment also completed.image

13. A release definition available.image

14. A deployment has triggered and deployed the application to Azure App Service.image

15. Application is running in Azure APP Service.image

16. To facilitate above build and deployment Azure Resource Manager service endpoint also generated.image

No comments:

Popular Posts