{"id":10712,"date":"2016-04-05T01:31:00","date_gmt":"2016-04-04T18:31:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/2015\/11\/28\/deploy-artifacts-from-onprem-tfs-server-with-release-management-service\/"},"modified":"2022-08-02T23:30:48","modified_gmt":"2022-08-03T07:30:48","slug":"deploy-artifacts-from-onprem-tfs-server-with-release-management-service","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/deploy-artifacts-from-onprem-tfs-server-with-release-management-service\/","title":{"rendered":"Deploy artifacts from OnPrem TFS server with Release Management Service"},"content":{"rendered":"<p><span style=\"font-size: medium\">[<strong>Update on\u00a05 Apr 2016<\/strong>: This feature\u00a0is now available again. You&#8217;ll need to install the <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-vscs-rm.vss-services-externaltfs\">External TFS Tools<\/a>\u00a0extension for it to work now. It is recommended to update any Release definitions that have been created using artifacts from an on-premises TFS server.]<\/span><\/p>\n<p><span style=\"font-size: medium\">[<strong>Update on\u00a012\u00a0Feb 2016<\/strong>: This feature\u00a0has been temporarily disabled in VSTS as it requires\u00a0some more work. Release definitions that have been created using artifacts from an on-premises TFS server\u00a0will continue to work. You won&#8217;t be able to create new release definitions until we re-enable this feature.]<\/span><\/p>\n<h2><span style=\"font-size: x-large\"><span style=\"color: #2e74b5;font-family: Calibri Light\">Summary<\/span><\/span><\/h2>\n<p><span style=\"font-size: medium\">Did you know you could consume artifacts from build definitions on an OnPrem TFS Server and deploy your applications using the Release management service in Visual Studio Team Services, that too without exposing the TFS Server to the internet?<\/span><\/p>\n<p><span style=\"font-size: medium\">Did you know that you could also deploy the applications to a OnPrem target environment using the service?<\/span><\/p>\n<p><span style=\"font-size: medium\">Did you know that all this happens without the artifacts leaving the secure and strict boundaries of your enterprise network, thereby ensuring you are safe from any information leaks?<\/span><\/p>\n<p><span style=\"font-size: medium\">In this blog, we shall talk about a walkthrough of consuming artifacts from an OnPrem TFS 2015 Server and deploying them to a target machine. <\/span><\/p>\n<p>\u00a0<\/p>\n<h2><span style=\"font-size: x-large\"><span style=\"color: #2e74b5;font-family: Calibri Light\">Pre-Requisites<\/span><\/span><\/h2>\n<p><span style=\"font-size: medium\">Before we go through the steps, it is assumed that \u2013<\/span><\/p>\n<ol>\n<li><span style=\"font-size: medium\">You have configured a build definition on the OnPrem TFS Server that\u2019s publishing artifacts. <\/span> \n<ol>\n<li><span style=\"font-size: small\">The published artifacts consist of the binaries for the application and a powershell script that can deploy the application on a target server. <\/span><\/li>\n<\/ol>\n<\/li>\n<li><span style=\"font-size: medium\">The target server on which the application should be deployed in configured for <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/aa384372(v=vs.85).aspx\"><span style=\"color: #0563c1;font-family: Calibri\">WinRM<\/span><\/a><\/span><\/li>\n<li><span style=\"font-size: medium\">Additionally, you have another machine prepared with <a href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkId=293881\"><span style=\"color: #0563c1;font-family: Calibri\">WMF 4.0<\/span><\/a>. This machine (we shall refer to it as the agent machine henceforth) should have access to the TFS Server and the target server.<\/span> \n<ol>\n<li><span style=\"font-size: small\">In case the artifacts are published to a file share, then the agent should also have access to the file share to which the artifacts are published.<\/span><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<h2><span style=\"color: #2e74b5;font-family: Calibri Light;font-size: x-large\">Configuring an Agent<\/span><\/h2>\n<p><span style=\"font-size: medium\">On the agent machine, you must install and configure a release agent. This shall act like a bridge between VS Team Services and your OnPrem network, facilitating the services to perform and monitor the deployments.<\/span><\/p>\n<p><span style=\"font-size: medium\">Follow the steps mentioned <a href=\"https:\/\/msdn.microsoft.com\/en-us\/Library\/vs\/alm\/Release\/getting-started\/configure-agents#Installinganagent\"><span style=\"color: #0563c1;font-family: Calibri\">here<\/span><\/a> (you can also watch the agent configuration in action <a href=\"https:\/\/www.youtube.com\/watch?v=Np_uLFYyjnU&#038;list=PLP3SfFPBD6cTJ2Jp5cHvjQ3flrbwQu-nN&#038;index=2\"><span style=\"color: #0563c1;font-family: Calibri\">here<\/span><\/a>). Note that it is advised to login as the account owner for VS Team Services while configuring the agent.<\/span><\/p>\n<p><span style=\"font-size: medium\">Once you\u2019ve done this, you would be able to see the agent listed in the default pool. <\/span><\/p>\n<p><span style=\"font-size: medium\"><a href=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/04\/0743.b2_img1.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/04\/0743.b2_img1.png\" alt=\"\" border=\"0\" \/><\/a><\/span><\/p>\n<p><span style=\"font-size: medium\">You shall also be able to find it listed with the default queue.<\/span><\/p>\n<p><span style=\"font-size: medium\"><a href=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/04\/4401.b2_img2.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/04\/4401.b2_img2.png\" alt=\"\" border=\"0\" \/><\/a><\/span><\/p>\n<p><span style=\"font-size: medium\">You can read more about agent pools and queues <a href=\"https:\/\/msdn.microsoft.com\/en-us\/Library\/vs\/alm\/Release\/getting-started\/configure-agents#Agentpoolandqueuesecurity\"><span style=\"color: #0563c1;font-family: Calibri\">here<\/span><\/a><\/span><\/p>\n<p>\u00a0<\/p>\n<h2><span style=\"font-size: x-large\"><span style=\"color: #2e74b5;font-family: Calibri Light\">Create a Service Endpoint for the TFS Server<\/span><\/span><\/h2>\n<p><span style=\"font-size: medium\">To consume builds from TFS server, you must first create a service endpoint with credentials to connect to TFS Server.<\/span><\/p>\n<p><span style=\"font-size: medium\">In a way, this is an authorization for VS Team Services to request the agent to fetch information from the TFS Server. The information (artifact binaries) is fetched and stored on the agent machine only. It is not shared with VS Team Services.<\/span><\/p>\n<p><span style=\"font-size: medium\">Also, the credentials are stored in an encrypted form not accessible to anyone.<\/span><\/p>\n<p><span style=\"font-size: medium\">These facts coupled with all communications to\/from VS team services being over HTTPS ensure that the security of the enterprise network\/ TFS Server is not compromised by doing so.<\/span><\/p>\n<p><span style=\"font-size: medium\">Set up the TFS endpoint in the <strong>Services<\/strong> tab of the <strong>Control Panel<\/strong> for your team project. Use the &#8220;External TFS&#8221; type, and enter the TFS server URL and credentials to connect to the TFS server. Note that this experience\u00a0currently works with basic authentication only. You&#8217;ll need to <a href=\"https:\/\/github.com\/Microsoft\/tfs-cli\/blob\/master\/docs\/configureBasicAuth.md\">enable basic authentication support <\/a>for the TFS Server.<\/span><\/p>\n<p><span style=\"font-size: medium\"> <\/span><span style=\"font-size: medium\">For more details, see <a href=\"https:\/\/msdn.microsoft.com\/Library\/vs\/alm\/Release\/author-release-definition\/understanding-tasks#serviceconnections\"><strong><span style=\"color: #0563c1;font-family: Calibri\">Service endpoints<\/span><\/strong><\/a>.<\/span><\/p>\n<ol>\n<li><span style=\"font-size: medium\">The Server URL needs to be upto the collection. For eg.\u00a0 <span style=\"text-decoration: underline\">http:\/\/example.com\/tfs\/DefaultCollection<\/span><\/span><\/li>\n<li><span style=\"font-size: medium\">The username and password would be domain credentials to authenticate with the TFS server. These would not be tested\/validated. Any mistake in theserverse would be detected only when you run the release<\/span>.<\/li>\n<\/ol>\n<h2><span style=\"font-size: x-large\"><span style=\"color: #2e74b5;font-family: Calibri Light\">Create a Release Definition<\/span><\/span><\/h2>\n<p><span style=\"font-size: medium\">We are now all set of start defining our deployment pipeline and configure continuous delivery for the application.<\/span><\/p>\n<ol>\n<li><span style=\"font-size: medium\">Goto the Release hub in a team project on VS Team Services<\/span><\/li>\n<li><span style=\"font-size: medium\">Click on New Release Definition and choose to start with an Empty template<\/span><\/li>\n<\/ol>\n<div style=\"padding-left: 60px\">\n<\/div>\n<div style=\"padding-left: 60px\">\n  <span style=\"font-size: medium\"><a href=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/04\/5270.b1_img3.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/04\/5270.b1_img3.png\" alt=\"\" border=\"0\" \/><\/a><\/span>\n<\/div>\n<div style=\"padding-left: 60px\">\n<\/div>\n<ol start=\"3\">\n<li>\n    <span style=\"font-size: medium\">In the empty release definition, we\u2019ll first link to the build definition and define the source of artifacts to deploy<\/span>.\n  <\/li>\n<\/ol>\n<div style=\"padding-left: 30px\">\n  <a href=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/04\/4747.b1_img5.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/04\/4747.b1_img5.png\" alt=\"\" border=\"0\" \/><\/a>\n<\/div>\n<ol start=\"4\">\n<li>\n    <span style=\"font-size: medium\">Select the endpoint we defined above and provide the values for the project name on the TFS 2015 server and the build definition defined on it.<\/span>\n  <\/li>\n<\/ol>\n<div style=\"padding-left: 30px\">\n  <a href=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/04\/8816.b1_img6.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/04\/8816.b1_img6.png\" alt=\"\" border=\"0\" \/><\/a>\n<\/div>\n<ol start=\"5\">\n<li>\n    <span style=\"font-size: medium\">For the \u201cdefault environment\u201d, add tasks to configure the deployment steps. In our case, we want to execute a powershell script on the target server with the artifact present locally on the target. We shall add the following two tasks for it and update the task parameters. <\/span> <\/p>\n<ol>\n<li>\n        <span style=\"font-size: medium\"><a href=\"https:\/\/github.com\/Microsoft\/vso-agent-tasks\/blob\/master\/Tasks\/WindowsMachineFileCopy\/README.md\"><span style=\"color: #0563c1;font-family: Calibri\">Windows Machine File Copy<\/span><\/a><\/span> <\/p>\n<ul>\n<li>\n            <span style=\"font-size: small\">The source location for the payload would be \u201c$(System.DefaultWorkingDirectory)<builddefinitioname>drop\u201d<\/span>\n          <\/li>\n<\/ul>\n<\/li>\n<li>\n        <span style=\"font-size: medium\"><a href=\"https:\/\/github.com\/Microsoft\/vso-agent-tasks\/blob\/master\/Tasks\/PowerShellOnTargetMachines\/README.md\"><span style=\"color: #0563c1;font-family: Calibri\">Powershell on target machines<\/span><\/a> <\/span>\n      <\/li>\n<\/ol>\n<\/li>\n<li>\n    <span style=\"font-size: medium\">We need to now make sure the deployment runs on the local agent we configured. We\u2019ll go set the agent queue to \u201cdefault\u201d for the environment &#038; create more environments in the release definition\u00a0as per need. Save the release definition giving a name of your choice.<\/span>\n  <\/li>\n<\/ol>\n<div style=\"padding-left: 30px\">\n  <span style=\"font-size: medium\"><a href=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/04\/1854.b1_img7.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/04\/1854.b1_img7.png\" alt=\"\" border=\"0\" \/><\/a><\/span>\n<\/div>\n<div style=\"padding-left: 30px\">\n<\/div>\n<h2><span style=\"font-size: x-large\"><span style=\"color: #2e74b5;font-family: Calibri Light\">Create a Release<\/span><\/span><\/h2>\n<div>\n  <span style=\"font-size: medium\">When you create a release for the configured release definition, you\u2019ll need to provide the exact build number of the build to release and select the environments to deploy to. Get that from the OnPrem TFS Server.<\/span>\n<\/div>\n<div>\n<\/div>\n<div style=\"padding-left: 30px\">\n  <a href=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/04\/1185.b1_img8.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/04\/1185.b1_img8.png\" alt=\"\" border=\"0\" \/><\/a>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<p><a class=\"twitter-follow-button\" href=\"https:\/\/twitter.com\/vsreleasemgmt\">Follow @vsreleasemgmt<\/a><\/p>\n<p>\/\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[Update on\u00a05 Apr 2016: This feature\u00a0is now available again. You&#8217;ll need to install the External TFS Tools\u00a0extension for it to work now. It is recommended to update any Release definitions that have been created using artifacts from an on-premises TFS server.] [Update on\u00a012\u00a0Feb 2016: This feature\u00a0has been temporarily disabled in VSTS as it requires\u00a0some more [&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":[226,1],"tags":[],"class_list":["post-10712","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ci","category-devops"],"acf":[],"blog_post_summary":"<p>[Update on\u00a05 Apr 2016: This feature\u00a0is now available again. You&#8217;ll need to install the External TFS Tools\u00a0extension for it to work now. It is recommended to update any Release definitions that have been created using artifacts from an on-premises TFS server.] [Update on\u00a012\u00a0Feb 2016: This feature\u00a0has been temporarily disabled in VSTS as it requires\u00a0some more [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/10712","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=10712"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/10712\/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=10712"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=10712"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=10712"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}