{"id":473,"date":"2014-11-10T23:23:00","date_gmt":"2014-11-10T23:23:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/2014\/11\/10\/deploying-and-testing-web-applications-using-release-management\/"},"modified":"2022-05-26T04:51:43","modified_gmt":"2022-05-26T12:51:43","slug":"deploying-and-testing-web-applications-using-release-management","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/deploying-and-testing-web-applications-using-release-management\/","title":{"rendered":"Deploying and testing web applications using Release Management"},"content":{"rendered":"<h2>Summary<\/h2>\n<p>You have downloaded the <a href=\"http:\/\/go.microsoft.com\/?linkid=9843000\">Release Management for Visual Studio client<\/a>, and are connected to either your Visual Studio Online account or to an on-premises Release Management Sever.<\/p>\n<p>You have created environments (either <a href=\"http:\/\/www.visualstudio.com\/get-started\/deploy-no-agents-vs#SetupAzure\">imported your Azure environments<\/a> or created on-premises) to be used in the various stages of your release template.<\/p>\n<p>Now you want to author the deployment sequence for deploying and validating your web application in each stage.<\/p>\n<p>In the current state, you will have to write Powershell scripts on your own to be used in a stage. We\u2019ll be looking to add a number of pre-done actions to help you avoid dealing with powershell scripts.<\/p>\n<p>This article will help you author Powershell scripts and configure the artifacts in release management for performing the tasks on target servers. Specifically, the following questions shall be addressed.<\/p>\n<ol>\n<li>How\u00a0to Install the necessary Powershell DSC modules on the target servers using Release Management.<\/li>\n<li>How to Deploy a website using the latest drop from a TFS build.<\/li>\n<li>How to Configure access to the deployed website using Release Management.<\/li>\n<li>How to run automated tests using Release Management and Publish the results to TFS.<\/li>\n<\/ol>\n<p>The attached zip file contains all the DSC modules as well as the Powershell scripts needed to perform the tasks above. We will use the xWebAdministration DSC module to perform some of the tasks. The zip file contains a version of this module. You can replace that with the latest version of the module from <a href=\"https:\/\/gallery.technet.microsoft.com\/scriptcenter\/xWebAdministration-Module-3c8bb6be\">MS Configuration Gallery<\/a><\/p>\n<h2>Prerequisites<\/h2>\n<p>Before we get started, here are some pre-requisites that must be present on your target servers of the environments.<\/p>\n<p>First, you must have <a href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkId=293881\" title=\"WMF 4.0\">WMF 4.0<\/a> installed on each of the target servers to get the latest version of Local Configuration Manager to manage desired state.<\/p>\n<p>Second, you must have vstest.console.exe on the target servers in order to run automated tests from a given test binary (we will use vstest runner instead of mstest), and to publish results back to TFS or Visual Studio Online. The easiest way to get this vstest runner is to install <a href=\"http:\/\/go.microsoft.com\/?linkid=9832003\" title=\"Visual Studio Test Agent\">Visual Studio Test Agent<\/a> and <a href=\"http:\/\/go.microsoft.com\/?linkid=9832116&amp;clcid=0x409\" title=\"Team Explorer\">Team Explorer<\/a> SKUs on the target servers.<\/p>\n<p>In a future article, we will cover how to automate installation of test agent, or how to run automated tests that are managed in a test plan.<\/p>\n<h2>Adding Scripts to your Visual Studio Solution<\/h2>\n<p><span style=\"color: #424242;font-family: 'Segoe UI','sans-serif';font-size: 9.5pt\" lang=\"EN\">For release management to orchestrate the deployment, the relevant deployment scripts need to be present in the build drop. Making the following changes to the Visual Studio Solution would help with this.<\/span><\/p>\n<p><span style=\"color: #424242;font-family: 'Segoe UI','sans-serif';font-size: 9.5pt\" lang=\"EN\">Assuming you have a web project and a test project, <\/span><span style=\"color: #424242;font-family: 'Segoe UI','sans-serif';font-size: 9.5pt\" lang=\"EN\">Copy AppDeploy to the web project and testDeploy to the test project. Ensure that the files added are dropped in the build output.<\/span><\/p>\n<p style=\"background: white\">\n  <span style=\"color: #424242;font-family: 'Segoe UI','sans-serif';font-size: 9.5pt\" lang=\"EN\">Check-in the changes to your solution.<\/span>\n<\/p>\n<p style=\"background: white\">\n  <span style=\"color: #424242;font-family: 'Segoe UI','sans-serif';font-size: 9.5pt\" lang=\"EN\">A sample\u00a0solution and the associated build drop would look like the following. The changes made are highlighted.<\/span>\n<\/p>\n<p style=\"background: white\">\n  <span style=\"color: #424242;font-family: 'Segoe UI','sans-serif';font-size: 9.5pt\" lang=\"EN\"><a href=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2014\/11\/4578.pic1_.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2014\/11\/4578.pic1_.png\" alt=\"\" border=\"0\" \/><\/a><\/span>\n<\/p>\n<p>\u00a0<\/p>\n<h2>Defining Release Management Components<\/h2>\n<p style=\"background: white\">\n  <span style=\"color: #424242;font-family: 'Segoe UI','sans-serif';font-size: 9.5pt\" lang=\"EN\">Using Release Management client, create three components as shown below.<\/span>\n<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2014\/11\/4431.pic3_.png\" alt=\"\" border=\"0\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2014\/11\/1307.pic4_.png\" alt=\"\" border=\"0\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2014\/11\/7534.pic5_.png\" alt=\"\" border=\"0\" \/><\/p>\n<h2>Authoring Deployment Sequence<\/h2>\n<p style=\"background: white\">\n  <span style=\"color: #424242;font-family: 'Segoe UI','sans-serif';font-size: 9.5pt\" lang=\"EN\">Author the deployment sequence in a stage to have the following sequential actions.<\/span>\n<\/p>\n<table style=\"width: 898px;height: 43px\">\n<tbody>\n<tr>\n<td>\n        <strong>Action<\/strong>\n      <\/td>\n<td>\n        <strong>Renamed As<\/strong>\n      <\/td>\n<td>\n        <strong>\u00a0Properties And Additional Configuration<\/strong>\n      <\/td>\n<td>\n        <strong>\u00a0<\/strong>\n      <\/td>\n<\/tr>\n<tr>\n<td>\n        <span style=\"color: #424242;font-family: 'Segoe UI','sans-serif';font-size: 9.5pt\">Deploy<br \/>using PS\/DSC<\/span>\n      <\/td>\n<td>\n        <span style=\"color: #424242;font-family: 'Segoe UI','sans-serif';font-size: 9.5pt\">Install<br \/>DSC Modules<\/span>\n      <\/td>\n<td>\n<ul>\n<li>\n            ComponentName = SampleWebApp-MySampleWebApp-Deploy\n          <\/li>\n<li>\n            PSScriptPath = .InstallModules.ps1\n          <\/li>\n<li>\n            SkipCaCheck = true\n          <\/li>\n<\/ul>\n<\/td>\n<td>\n        \u00a0<a href=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2014\/11\/8737.pic6_.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2014\/11\/8737.pic6_.png\" alt=\"\" width=\"417\" height=\"169\" border=\"0\" \/><\/a>\n      <\/td>\n<\/tr>\n<tr>\n<td>\n        <span style=\"color: #424242;font-family: 'Segoe UI','sans-serif';font-size: 9.5pt\">Deploy<br \/>using PS\/DSC<\/span>\n      <\/td>\n<td>\n        <span style=\"color: #424242;font-family: 'Segoe UI','sans-serif';font-size: 9.5pt\">Deploy<br \/>Website<\/span>\n      <\/td>\n<td>\n<ul>\n<li>\n            ComponentName = SampleWebApp-MySampleWebApp-PublishedWebSite\n          <\/li>\n<li>\n            PSScriptPath = DeployDeployWebsite.ps1\n          <\/li>\n<li>\n            PSConfigurationPath = Deploy DeployWebsiteconfigData.ps1\n          <\/li>\n<li>\n            SkipCaCheck = true\n          <\/li>\n<li>\n            WebsitePort = 8085\n          <\/li>\n<li>\n            WebAppPoolName = SampleWebApp\n          <\/li>\n<\/ul>\n<\/td>\n<td>\n        \u00a0<a href=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2014\/11\/2465.pic7_.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2014\/11\/2465.pic7_.png\" alt=\"\" width=\"419\" height=\"224\" border=\"0\" \/><\/a>\n      <\/td>\n<\/tr>\n<tr>\n<td>\n        <span style=\"color: #424242;font-family: 'Segoe UI','sans-serif';font-size: 9.5pt\">Deploy<br \/>using PS\/DSC<\/span>\n      <\/td>\n<td>\n        <span style=\"color: #424242;font-family: 'Segoe UI','sans-serif';font-size: 9.5pt\">Configure<br \/>App Pool<\/span>\n      <\/td>\n<td>\n<ul>\n<li>\n            ComponentName = SampleWebApp-MySampleWebApp-Deploy\n          <\/li>\n<li>\n            PSScriptPath = .ChangeAppPoolIdentity.ps1\n          <\/li>\n<li>\n            SkipCaCheck = true\n          <\/li>\n<li>\n            WebAppPoolName = SampleWebApp\n          <\/li>\n<\/ul>\n<\/td>\n<td>\n        \u00a0<a href=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2014\/11\/5504.pic8_.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2014\/11\/5504.pic8_.png\" alt=\"\" width=\"420\" height=\"232\" border=\"0\" \/><\/a>\n      <\/td>\n<\/tr>\n<tr>\n<td>\n        <span style=\"color: #424242;font-family: 'Segoe UI','sans-serif';font-size: 9.5pt\">Deploy<br \/>using PS\/DSC<\/span>\n      <\/td>\n<td>\n        <span style=\"color: #424242;font-family: 'Segoe UI','sans-serif';font-size: 9.5pt\"><span style=\"color: #424242;font-family: 'Segoe UI','sans-serif';font-size: 9.5pt\">Run<br \/>Tests<\/span><\/span>\n      <\/td>\n<td>\n<ul>\n<li>\n            ComponentName = SampleWebApp-MySampleWebApp-Root\n          <\/li>\n<li>\n            PSScriptPath = .DeployRunTests.ps1\n          <\/li>\n<li>\n            SkipCaCheck = true\n          <\/li>\n<li>\n            testDllPath = UniTestProject1.dll\n          <\/li>\n<li>\n            TFSAlternateUserName = <Alternate UserName for Account>\n          <\/li>\n<li>\n            TFSAlternatePassword = <Alternate Password for<br \/>Account>\n          <\/li>\n<\/ul>\n<\/td>\n<td>\n        \u00a0<a href=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2014\/11\/6747.file9_.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2014\/11\/6747.file9_.png\" alt=\"\" width=\"419\" height=\"314\" border=\"0\" \/><\/a>\n      <\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u00a0The overall deployment sequence would look like &#8211;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2014\/11\/1134.file19.png\" alt=\"\" width=\"179\" height=\"322\" border=\"0\" \/><\/p>\n<h2>Triggering Releases<\/h2>\n<p>Now, you are ready to trigger a release and verify that all of the actions are run.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2014\/11\/1016.file10.png\" alt=\"\" border=\"0\" \/><\/p>\n<h2>Disclaimer<\/h2>\n<p>The scripts provided in this blog are provided as-is, and may have to be modified to work with your application and your environment.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/02\/RMWebAppDeployment.zip\">RMWebAppDeployment.zip<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary You have downloaded the Release Management for Visual Studio client, and are connected to either your Visual Studio Online account or to an on-premises Release Management Sever. You have created environments (either imported your Azure environments or created on-premises) to be used in the various stages of your release template. Now you want to [&hellip;]<\/p>\n","protected":false},"author":67,"featured_media":45953,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[224,226,1],"tags":[],"class_list":["post-473","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-azure","category-ci","category-devops"],"acf":[],"blog_post_summary":"<p>Summary You have downloaded the Release Management for Visual Studio client, and are connected to either your Visual Studio Online account or to an on-premises Release Management Sever. You have created environments (either imported your Azure environments or created on-premises) to be used in the various stages of your release template. Now you want to [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/473","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/users\/67"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/comments?post=473"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/473\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media\/45953"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media?parent=473"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=473"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}