{"id":31586,"date":"2017-05-10T00:00:16","date_gmt":"2017-05-10T08:00:16","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/?p=31586"},"modified":"2019-02-14T15:51:45","modified_gmt":"2019-02-14T23:51:45","slug":"use-azure-portal-to-setup-continuous-delivery-for-web-app-on-linux","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/use-azure-portal-to-setup-continuous-delivery-for-web-app-on-linux\/","title":{"rendered":"Use Azure portal to setup Continuous Delivery for Web App On Linux"},"content":{"rendered":"<p>Continuous Delivery in Visual Studio Team Services simplifies setting up a robust deployment pipeline for your Web App on Linux.\u00a0 By default, the pipeline builds a container image, pushes the image to a container registry and deploys the new image to the Web App. You can easily add another Azure Web App on Linux to the pipeline to validate your changes before they ever get to production.<\/p>\n<p>You can extend this deployment automation to handle any other operations your application needs to do during deployment. For example, provision additional Azure resources, run scripts, upgrade database or run additional validation tests.<\/p>\n<p><strong>Code<\/strong><\/p>\n<p>You can store your app&#8217;s source code in a<span>\u00a0<\/span><span><a href=\"https:\/\/www.visualstudio.com\/en-us\/docs\/git\/gitquickstart\">Team Services Git<\/a><\/span>,<span>\u00a0<\/span><span><a href=\"https:\/\/help.github.com\/articles\/create-a-repo\">GitHub<\/a><\/span> to use Azure Continuous Delivery.<\/p>\n<ul>\n<li><span><a href=\"https:\/\/github.com\/azooinmyluggage\/WebAppOnLinuxDemo\">Download\/fork our Node.js Hello World sample app<\/a><\/span> or Install Node.<span><a href=\"https:\/\/www.visualstudio.com\/en-us\/features\/node-js-vs.aspx\">js Tools for Visual Studio<\/a><\/span> and create a new Node.js application.<\/li>\n<li>Upload your code to Team Services Git or GitHub<\/li>\n<li>You also need a <span><a href=\"https:\/\/docs.docker.com\/engine\/reference\/builder\/\">Dockerfile<\/a><\/span> in the repository which has the instructions required to build the image. Our sample repository has a <span><a href=\"https:\/\/github.com\/azooinmyluggage\/WebAppOnLinuxDemo\/blob\/master\/NodejsWebApp1\/Dockerfile\">Dockerfile<\/a><\/span> for your reference.<\/li>\n<\/ul>\n<p><strong>Configure<\/strong><\/p>\n<ul>\n<li>In the\u00a0<span><\/span><span><a href=\"https:\/\/portal.azure.com\/\">Azure portal<\/a><\/span>, select your web app. If you haven&#8217;t yet created a web app, do this now by choosing the &#8220;<strong>+<\/strong>&#8221; icon, selecting<span>\u00a0<\/span><strong>Web App on Linux<\/strong><span>\u00a0<\/span>from the<span>\u00a0<\/span><strong>Web + Mobile<\/strong><span>\u00a0<\/span>category, and providing a name and a resource group.<\/li>\n<li>In your app&#8217;s menu blade, choose\u00a0<span><\/span><strong>Continuous Delivery (Preview)<\/strong><span>\u00a0<\/span>and then choose<span>\u00a0<\/span><strong>Configure<\/strong>.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/26.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/05\/26-1024x588.png\" alt=\"Configure CD Step1\" width=\"879\" height=\"505\" class=\"size-large wp-image-31605 aligncenter\" \/><\/a><\/p>\n<ul>\n<li>Select Choose container registry. The setup wizard will read and show the container registry settings for the selected Web App on Linux.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/34.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/05\/34-300x205.png\" alt=\"Continuous Deliver Step 2\" width=\"300\" height=\"205\" class=\"size-medium wp-image-31606 aligncenter\" \/><\/a><\/p>\n<ul>\n<li>In case you want to change your container registry setting you can do that by going to the Docker Container setting of the Web App.\u00a0\u00a0The<span>\u00a0<\/span><strong>Startup command<\/strong><span>\u00a0<\/span>is set automatically based on what is defined in the Docker image file, but you can set your own commands.<\/li>\n<\/ul>\n<ul>\n<li>Select\u00a0<span><\/span><strong>Configure continuous delivery<\/strong><span>\u00a0<\/span>and select the type of repository where you stored your app&#8217;s source code. You have a choice of<span>\u00a0<\/span><strong>Visual Studio Team Services Git<\/strong>,<span>\u00a0<\/span><strong>GitHub<\/strong><span>\u00a0<\/span>(support for other repository types will be enabled soon).\u00a0Select the repository, and branch to deploy from. When you&#8217;re done, choose\u00a0<span><\/span><strong>OK<\/strong>. You can choose to give the Dockerfile path. By default we will try to find a Dockerfile and use it for building images.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/54.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/05\/54-300x127.png\" alt=\"Choose repository\" width=\"300\" height=\"127\" class=\"size-medium wp-image-31656 aligncenter\" \/><\/a><\/p>\n<ul>\n<li>Select<span><\/span><strong>\u201cTeam Service Account\u201d<\/strong><span>\u00a0<\/span>and choose the Team Services account where you want to setup the Continuous Delivery. In case you don\u2019t have a team service account, you can choose to create a new account. When you&#8217;re done, choose<span>\u00a0<\/span><strong>OK<\/strong> to create and execute the Continuous Delivery workflow.<\/li>\n<\/ul>\n<p>The following sequence of events occurs:<\/p>\n<ul>\n<ul>\n<li><em>After the build has completed successfully, a new release is created and the deployment triggered. The Web App pulls the new container image from registry and updates itself.<\/em><\/li>\n<li><em>After setup has completed successfully, a build is triggered that creates a container image and pushes it to the container registry associated with the Web App.<\/em><\/li>\n<li><em>Azure Continuous Delivery creates a build and a release definition in the Team Services account you specified, together with a service endpoint each to connect to Azure and Container registry.<\/em><\/li>\n<\/ul>\n<\/ul>\n<ul>\n<li>After all these actions have completed, the Azure portal shows the results in the\u00a0<span><\/span><strong>Activity Log<\/strong>.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/71.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/05\/71-300x153.png\" alt=\"7\" width=\"300\" height=\"153\" class=\"size-medium wp-image-31666 aligncenter\" \/><\/a><\/p>\n<ul>\n<li>In the &#8220;Successfully set up Continuous Delivery&#8230;&#8221; item, choose the\u00a0<strong>Release Definition<\/strong>\u00a0link to open the project containing your app in Team Services, and see the list of releases for this definition. Choose\u00a0<strong>Edit<\/strong>\u00a0to see the tasks that have been added and configured. There are also links in other items in the<span>\u00a0<\/span><strong>Activity Log<\/strong><span>\u00a0<\/span>that open commits, builds, build reports, releases, deployment slots, and the deployed app itself, in relevant windows or apps.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/8.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/05\/8-300x119.png\" alt=\"8\" width=\"300\" height=\"119\" class=\"size-medium wp-image-31675 aligncenter\" \/><\/a><\/p>\n<ul>\n<li>In the &#8220;Successfully set up Continuous Delivery&#8230;&#8221; item, choose the\u00a0<strong>Build Definition<\/strong>\u00a0link to open the project containing your app in Team Services, and see the summary for the build definition. Choose\u00a0<strong>Edit<\/strong>\u00a0to see the Docker tasks that have been added and configured.<\/li>\n<li>Verify that continuous deployment is occurring from the repository containing your app by pushing a change to the repository. Your app should update to reflect the changes shortly after the push to the repository completes. You can stop a deployment to your Azure Web App on Linux by choosing<span>\u00a0<\/span><strong>Disconnect<\/strong><span>\u00a0<\/span>at the top of the<span>\u00a0<\/span><strong>Continuous Delivery<\/strong><span>\u00a0<\/span>blade. This deletes the Azure Continuous Delivery configuration in the Azure portal and turns off the build triggers in your Team Services account for this configuration.<\/li>\n<\/ul>\n<p><strong>Next steps<\/strong>\nYou can easily add another Azure Web App on Linux to the pipeline to validate your changes before they reach production. These validation can be done by running load or functional tests at each step. You can even choose to deploy automatically, or set up manual approval for any deployment to production.<\/p>\n<p>The Azure Continuous Delivery feature is a preview version. You may encounter the following known issues:<\/p>\n<ul>\n<li>If you do not have relevant permission to create build and release definitions in the Team Services account, the Continuous Delivery configuration will fail with an appropriate error message. See\u00a0<span><\/span><span><a href=\"https:\/\/www.visualstudio.com\/en-us\/docs\/setup-admin\/team-services\/add-account-users-assign-access-levels-team-services\">Manage users and access in Visual Studio Team Services<\/a><\/span>.<\/li>\n<li>If you encounter the error &#8220;Failed to create an Azure service connection&#8221; while deploying to Azure Web App on Linux, see\u00a0<span><a href=\"https:\/\/www.visualstudio.com\/en-us\/docs\/build\/actions\/azure-rm-endpoint\">Troubleshoot Azure Resource Manager service endpoints<\/a><\/span>.<\/li>\n<li>Support for other repository types like TFVC, External Git and BitBucket is coming soon<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Continuous Delivery in Visual Studio Team Services simplifies setting up a robust deployment pipeline for your Web App on Linux.\u00a0 By default, the pipeline builds a container image, pushes the image to a container registry and deploys the new image to the Web App. You can easily add another Azure Web App on Linux to [&hellip;]<\/p>\n","protected":false},"author":230,"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-31586","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-azure","category-ci","category-devops"],"acf":[],"blog_post_summary":"<p>Continuous Delivery in Visual Studio Team Services simplifies setting up a robust deployment pipeline for your Web App on Linux.\u00a0 By default, the pipeline builds a container image, pushes the image to a container registry and deploys the new image to the Web App. You can easily add another Azure Web App on Linux to [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/31586","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\/230"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/comments?post=31586"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/31586\/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=31586"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=31586"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=31586"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}