<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by SAURABH RAI on Medium]]></title>
        <description><![CDATA[Stories by SAURABH RAI on Medium]]></description>
        <link>https://medium.com/@rsaurabh79?source=rss-e78729fe5034------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5EoHwv02TIYfkZSg85AAAw.jpeg</url>
            <title>Stories by SAURABH RAI on Medium</title>
            <link>https://medium.com/@rsaurabh79?source=rss-e78729fe5034------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 15:10:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rsaurabh79/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Enhancing Azure DevOps YAML Pipeline for multi-environment Deployments]]></title>
            <link>https://medium.com/@rsaurabh79/enhancing-azure-devops-yaml-pipeline-for-multi-environment-deployments-433a755d1558?source=rss-e78729fe5034------2</link>
            <guid isPermaLink="false">https://medium.com/p/433a755d1558</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[yaml]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[azure-devops]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[SAURABH RAI]]></dc:creator>
            <pubDate>Tue, 02 Jan 2024 17:05:21 GMT</pubDate>
            <atom:updated>2024-01-02T17:05:21.789Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DgshEcVo_cPzDZYH" /><figcaption>Photo by <a href="https://unsplash.com/@growtika?utm_source=medium&amp;utm_medium=referral">Growtika</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>As everyone is aware, creating separate pipelines for each environment (dev, tst, stg, and prod) can be tedious and complicate the process of managing several pipelines. So, as a DevOps engineer, the main goal is to minimize complexity and create efficient solutions.</p><p>This article will explain how to enhance the YAML pipeline to enable multi-environment deployment within a single pipeline.</p><p>Before moving ahead, let&#39;s do a quick recap of the YAML terminologies we will use in the pipeline.</p><ol><li><strong>Parameters: </strong>A parameter represents a value passed to the pipeline; it can be of many types, such as <em>string, number, boolean, object,</em> etc.</li><li><strong>Expressions: </strong>This can be used in many places where you need to specify a value, such as a string, number, boolean, object, etc, while creating a pipeline. Expressions can be checked at runtime or at compile time.<br> — <strong>Runtime time:</strong> These expressions are used in variables and conditions but don’t have access to parameters. <strong>syntax:</strong> $[ &lt;expression&gt; ]<br> — <strong>Compile time:</strong> These expressions can be used anywhere and have access to parameters and static variables. <strong>syntax:</strong> ${{ &lt;expression&gt; }}</li><li><strong>Each Loop:</strong> The <em>“each”</em> keyword is used to iterate through the defined parameters or variables one by one.</li><li><strong>Strategy: </strong>The <strong><em>“</em></strong><em>strategy</em><strong><em>”</em> </strong>keyword specifies which strategy is to be used for deployment. There are three types of<strong> </strong>strategies: runOnce, rolling, and canary.</li></ol><p>I hope you are now refreshed with the terminologies, so let’s start with the enhancements to the YAML pipeline. So I will be taking a very basic example of printing the <em>“environment name</em>” from the variable group of the respective environments.</p><pre>trigger:<br>- main<br><br>pool:<br>  vmImage: windows-latest<br><br># Parameters for all environments.<br>parameters:<br>  - name: stages<br>    type: object<br>    default:<br>      - name : dev<br>      - name : tst<br>      - name : stg<br>      - name : prod<br><br>stages:<br>  - ${{each stage in parameters.stages}}: # Use of expressions and each loop to iterate over defined parameters.<br>    - stage: ${{stage.name}} # Dynamically selecting stage as per the environment.<br>      variables:<br>      - group: vg-${{stage.name}} # Dynamically selecting variable groups as per environment.<br>      jobs:<br>        - deployment: ${{stage.name}}_deploy # Dynamically selecting the environment for deployment.<br>          environment: ${{stage.name}}_environment # Dynamically selecting the environment.<br>          workspace:<br>            clean: all<br>          strategy:<br>            runOnce:<br>              deploy:<br>                steps:<br>                - script: | # Simple Bash Scirpt to check Multi Environment by printing environment variable from Variable group.<br>                    echo ####################################<br>                    echo Current Environment - $(environment) <br>                    echo ####################################<br>                  displayName: &#39;$(environment) environment&#39;</pre><p>So in the above YAML code, I have used <em>parameters </em>with <em>type </em>as <em>object </em>to define all environments (<em>dev, tst, stg, prod</em>).<br>As I have defined parameters in the code, I have also used compile-time expressions with “<em>each loop</em>” so that it would iterate over all the environments. As you can see in the expression, all the values from the parameters will be assigned to “<em>stage</em>” within the loop one by one: <em>“${{each stage in parameters.stages}}”.</em></p><p>Similarly, stage.name-&gt;<em>&quot;${{stage.name}}&quot;</em> is used to get the name of the current environment, which will dynamically select stage, environment, deployment, and variable groups passed by the parameters in each iteration.<br>For the deployment strategy, I have used the <em>“runOnce”</em> strategy so that it will run each step one time.</p><p>Once you have created the pipeline with the above YAML code, you can run the pipeline manually, and it will show you all the parameters (dev, tst, stg, prod) as stages, as shown in the below screenshot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*QjJROHnd7T_1eTmC9Wi0nQ.png" /><figcaption>All parameters will become stages while triggering the pipeline.</figcaption></figure><p>Before running the pipeline, let us see the variable groups as shown in the below screenshot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/1*vud2vg1DSjHfaZWyzFLBwQ.png" /><figcaption>Variable Groups as per Environment</figcaption></figure><p>As you can see, all variable groups are created as per the environment and have only one variable, <em>&quot;environment”.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*vXzQJGkDsjuD_q-YH8o3Hw.png" /><figcaption>Environment Variable</figcaption></figure><p>Now, once you run the pipeline, it will sequentially trigger all environments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f1MZnKaKQuo_4MGkEfV2Zg.png" /><figcaption>Sequentially all environments are triggered.</figcaption></figure><p>Even if the environments are triggered, it will not start the deployment process as it requires variable group and environment permission. So you need to click on <em>“Permit”</em> to allow both variable groups and environments to start the deployment process.<br><strong>Note:</strong> You need to permit this once in each environment and variable group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/429/1*vSJeXf1tu5InQOIkrSZk-A.png" /><figcaption>Permissions for Variable Group and Environment</figcaption></figure><p>Once you permit the environment and variable group, the deployment will start from a lower to a higher environment (dev → tst → stg → prod).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*joZxcVZfw6N8ufsP_Tx0Sg.png" /><figcaption>Successful Deployment to all environments</figcaption></figure><p>As we see in the above screenshot, the deployments to all the environments are complete. Now we can check the bash script output to confirm what it has printed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9GV8_tmkfFiI6CqlOWeewQ.png" /></figure><p>As we see in the above screenshot, for the <em>“Dev environment”</em> it has printed <em>“dev” </em>and similarly, for the other respective environments, it will print the respective environment variable.</p><p>So by doing this, we have achieved multi-environment deployment using a single pipeline. I have just used a simple bash script example, but you can add your app and infrastructure deployment scripts, and it will run similarly.</p><p>To restrict direct deployments in higher environments, you can add approval gates in higher environments such as tst, stg, and prod. To do so, navigate to the environment section in the left panel under the pipeline, where you will find all the environments, as shown in the below screenshot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cdMd2osMqU9Y2qxSOLK_tQ.png" /><figcaption>All environments</figcaption></figure><p>Select tst/stg/prod where you need to add approval, go to the <em>“Approvals and checks”</em> tab, and click on <em>&quot;Approvals”</em>, After that, add the user or group name to add as <em>“Approver”</em> to that environment and click on <em>“Create”.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*onvrmsVCtZUBxd_eRfxTPg.png" /><figcaption>Approvals and checks tab</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*5W8ok3DqWtXWdWBZo8rz9Q.png" /><figcaption>Add User or Group Name as Approver</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BG2U8N7kpLVDDd9fQoYOzw.png" /><figcaption>Added Approver.</figcaption></figure><p>Once you add the approver, whenever there is a deployment in that environment, the approver has to approve the deployment request. If you have added multiple users or groups, everyone has to approve the deployment request. Until the request is approved, the pipeline will be in a “<em>waiting</em>” state.</p><p>So now, after adding the approval gates, the pipeline will ask for approval before starting the deployment, as shown in the below screenshot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*101X6ocpV4-EX6uutGHBtQ.png" /><figcaption>Approval for higher environment deployment</figcaption></figure><p>So as soon as you approve the request, the deployment will start.</p><p>You can also find the YAML code on my <a href="https://github.com/rsaurabh799/DevOps_Series/blob/main/YAML/multi-environment-pipeline.yml">GitHub</a>.</p><p><strong>Conclusion<br></strong>We have successfully created a single pipeline that can handle multi-environment deployments without creating any additional pipelines. By doing this, we can reduce the complexity of managing multiple pipelines for deployments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=433a755d1558" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CI/CD Pipeline in Azure DevOps]]></title>
            <link>https://medium.com/@rsaurabh79/ci-cd-pipeline-in-azure-devops-c83df4c45a98?source=rss-e78729fe5034------2</link>
            <guid isPermaLink="false">https://medium.com/p/c83df4c45a98</guid>
            <category><![CDATA[azure-devops]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[continuous-deployment]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[vsts]]></category>
            <dc:creator><![CDATA[SAURABH RAI]]></dc:creator>
            <pubDate>Mon, 20 Jul 2020 19:08:20 GMT</pubDate>
            <atom:updated>2020-07-20T19:08:20.352Z</atom:updated>
            <content:encoded><![CDATA[<p>Every industry is adapting the CI/CD model as it gives an advantage of faster &amp; reliable deployments which makes your delivery model highly efficient. This article will explain to you how to set up a CI/CD pipeline in Azure using an angular application.</p><p>The main goal of DevOps is to provide faster &amp; reliable deployments. you can achieve these using the below steps.</p><ol><li>Check for the latest code pushed on the repository by the developers.</li><li>Build.</li><li>Test.</li><li>Deploy code to the server.</li></ol><h4><strong>What is CI/CD Pipeline?</strong></h4><p>CI/CD pipeline is an automated list of the process which helps in continuous integration of code pushed by the developers, performing certain mechanism like building, running tests, code analysis, etc. at last deploying it to the production environment automatically. This helps to reduce manual mistakes &amp; increases product releases.</p><p><strong>Continuous Integration</strong> — In this process, when the code is pushed on the repository, CI is triggered to fetch the latest code and after the successful fetch, other processes are been executed like build &amp; test.</p><p><strong>Continuous Deployment</strong> — In this process, the latest build is been deployed to the server.</p><h4>Goals</h4><ol><li>Setup Angular Project &amp; Git Repository.</li><li>Create App service on Azure.</li><li>Create an Organization &amp; Project on Visual Studio Team Service (VSTS).</li><li>Add Service Connections to integrate &amp; deploy your GitHub project with VSTS.</li><li>Create a Build &amp; Release Pipeline to Build, Test &amp; Deploy your code.</li><li>Check your application.</li></ol><h4>Prerequisites</h4><p>In this article, you’ll be working on an angular project.</p><p>If you don’t have Visual Studio Code IDE you can download it from <a href="https://code.visualstudio.com/"><em>here</em></a><em>.<br></em>You should also have an Azure account, you can create a free account from <a href="https://azure.microsoft.com/en-us/free/"><em>here</em></a><em>. </em>To Push your code to the repository you will need a <a href="https://github.com/join"><em>GitHub account</em></a> &amp; git bash, you can download git bash from <a href="https://git-scm.com/downloads"><em>here</em></a><em>. </em>For an angular project, you need to install <a href="https://nodejs.org/en/"><em>Nodejs</em></a> in your system.</p><h4>Setting up an Angular Project &amp; Git Repository.</h4><p>To start with an angular project you need to run following command in CLI. This command will install the latest angular version globally.</p><pre>npm install -g @angular/cli</pre><p>After installing the angular you need to create a project by using below command in CLI. In the below command “<em>new-app</em>” is the project name.</p><pre>ng new new-app</pre><pre>cd new-app //navigate to workspace i.e. project</pre><p>Now after creating the project you have to run it using below command.</p><pre>ng serve // project will run on default port 4200</pre><pre>or </pre><pre>ng serve --port port_name //specify port of your choice</pre><p>Now you can check your project running on <a href="http://localhost:4200/">http://localhost:4200/</a>, port 4200 is a default port.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F3uc8694XNDpkSWvf_Ca_w.jpeg" /><figcaption>Figure 1: Running your angular application.</figcaption></figure><p>Now open the project in Visual Studio code editor to make some changes to it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CguiwLCZ4dHntoLkhoRVwA.jpeg" /><figcaption>Figure 2: Opening the project in VS Code.</figcaption></figure><p>After opening the project in VS Code, I have changed the title from “<em>Welcome to new-app</em>” to “<em>My first Angular Application</em>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sOfzDwiXnlyp6GZZcmKe_w.jpeg" /><figcaption>Figure 3: Title update.</figcaption></figure><p>Now I have made the changes that I required, now its time to put this on GitHub.</p><ol><li>Create a new repository on GitHub and added a repository name after that click on “<em>Create repository</em>”.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*mSrsPnlFTRtY4WryIQIDgg.jpeg" /><figcaption>Figure 4: Create a new repository.</figcaption></figure><p>2. Open git bash in the project and run the below commands.</p><pre>$ git init // Initializing git in the project.</pre><pre>$ git add . // Adding all files.</pre><pre>$ git commit -m &quot;First Commit&quot; // Adding first Commit.</pre><pre>$ git remote add origin https://github.com/&lt;username&gt;/&lt;repository_name&gt;.git // Adding remote repository URL.</pre><pre>$ git push -u origin master // Pushing your code to the remote repository.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*BNGiBkYEZW6dd4zcWGdVfA.jpeg" /><figcaption>Figure 5: After pushing your code to the remote repository.</figcaption></figure><h4>Creating App Service on Azure Portal.</h4><p>To create an app service you have to visit <a href="https://portal.azure.com/"><em>Azure Portal</em></a><em>. </em>After that, you have to click on App Service and fill the required fields such as “<em>Resource Group</em>”, “<em>App Name</em>”, for “<em>Publish</em>” select “<em>code</em>” from the radio button, for “<em>Runtime stack</em>” select node “10.6” as we will be deploying an angular application, for “<em>OS</em>” select “Windows”, “<em>Region</em>”, “<em>App service plan</em>” &amp; for “<em>SKU and size</em>” I will be using the F1 free plan available. Once done with all the fields click on “<em>Review + Create</em>” this will create your app service in a few minutes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TdAbftlENmQa1eIf68n4ZQ.png" /><figcaption>Figure 6: App service creation.</figcaption></figure><p>Once App is created click on the “<em>Go to resource</em>” button you will see your app service running.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6_Y4hEow99sPWfhv3bdUmg.jpeg" /><figcaption>Figure 7: After the successful deployment of an app service.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mRvfS2OfzDuQwe5SS4OLAQ.jpeg" /><figcaption>Figure 8: App service</figcaption></figure><p>Now click on “<em>URL</em>” to check the app service which you created in working or not. You will see the default page publish on the URL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L7ZXt4VClLMRzFk2Ise1wg.jpeg" /><figcaption>Figure 9: Default page.</figcaption></figure><h4>Creating an Organization in Visual Studio Team Service (VSTS).</h4><p>To create an organization in VSTS you have to visit <a href="https://dev.azure.com/">https://dev.azure.com/</a>,<br>this will redirect you to create organization page after that you have to provide the name of your choice and click on “<em>continue” this will create your organization.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*S9PSw1R6l04JGFCZqLatdg.jpeg" /><figcaption>Figure 10: Create Organization.</figcaption></figure><p>Once you create an organization you will get an option to create a Project, give a project name, and select the visibility after that click on “<em>create project</em>” this will create an empty project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nb_YPnnA1eNGqP2rrxJBaQ.jpeg" /><figcaption>Figure 11: Create Project.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rjBg0VBv62mA1zSxSx53Mg.jpeg" /><figcaption>Figure 12: VSTS project.</figcaption></figure><h4>Add service connections to build &amp; deploy your Github project with VSTS</h4><p>It is very important to add a service connection between VSTS &amp; Github as this helps VSTS to trigger CI whenever a new push is been done on the repository.</p><p>To achieve that connection you have to configure it in project settings at the bottom. Once you click “<em>project setting</em>” it will open a bunch of settings that you can configure in the project as per your requirements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xoCCCIUK_85J7LAuduwtzw.png" /><figcaption>Figure 13: Project Settings.</figcaption></figure><p>Now click on “<em>Service Connections</em>” as we have to configure our GitHub repository to VSTS. After that, you will get a page to create your first service connection just click on the “<em>Create service connection</em>” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vUy51AI5A4KhZ2PqvEH__A.png" /><figcaption>Figure 14: Service Connections</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*QGYRRt6CsohOaa2kcqijgw.png" /><figcaption>Figure 15: Create a service connection.</figcaption></figure><p>After clicking the service connection button search for Github &amp; select it and click on “<em>next</em>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MTtmxAs9E57c3OvwonuLNg.jpeg" /><figcaption>Figure 16: Select GitHub.</figcaption></figure><p>After clicking on next you will get a page to fill GitHub details, now click on “<em>Personal Access token</em>” and add your access token in the Authentication area after that click on “<em>Verify</em>” this will verify the connection between GitHub &amp; VSTS also provide the name of the connection and at last click on “<em>Verify &amp; save</em>” this will create a connection between GitHub &amp; VSTS so now whatever is push on the repository it will be triggered by CI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B-J7sxwIkYkdhfejMthQ7g.jpeg" /><figcaption>Figure 17: Connection between GitHub &amp; VSTS.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*28Gqx4e6jM5hYz4haDOUiQ.jpeg" /><figcaption>Figure 18: GitHub Service Connection.</figcaption></figure><h4>Creating a Build &amp; Release Pipeline.</h4><p>We are all set with the GitHub service connection now we can start designing the pipeline. The pipeline will be designed in two steps given below.</p><ol><li>Build.</li><li>Release</li></ol><p>We will start with the <strong>Build pipeline</strong>.</p><p>Select “<em>Pipelines</em>” and click on “<em>Create Pipeline</em>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p3B2mufyN37tMW6zZr0isg.png" /><figcaption>Figure 19: Create a Pipeline.</figcaption></figure><p>Now click on “<em>use the classic editor</em>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*ioQ_e5KYXEVTcEu1NQnd_g.png" /><figcaption>Figure 20: Select Classic Editor.</figcaption></figure><p>Now you have to link your Github project so Select “<em>Github</em>” from the source and choose your repository &amp; branch and click on “<em>continue</em>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KP4Wn6g0OV4gMCVBps9XLA.jpeg" /><figcaption>Figure 21: Select GitHub &amp; repository.</figcaption></figure><p>After setting your repository now click on “<em>Empty job</em>” this will set up the pipeline with zero agents.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TV6J0YS1C8nGEXuDb0YJ2w.png" /><figcaption>Figure 22: Select Empty Job.</figcaption></figure><p>Now you have to click on “+” sign to add agents and search for agents as per your project requirements. Basically the pipeline works on agent so in our case, you have an angular application so you need agents like “<em>npm</em>” to install &amp; built the project, “<em>Archive file</em>” for archive the files at last “<em>Publish Build Artifacts</em>” it is to copy files to the server. After adding all the agents you have to add all required fields as per agents.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PCSpyi8wpqNJwzE_q52TuA.jpeg" /><figcaption>Figure 23: NPM install.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q2XC_NfZSAEeaQKjBri-Eg.jpeg" /><figcaption>Figure 24: Build Project.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*048f807vS4CIbvW7DQ9nUA.jpeg" /><figcaption>Figure 25: Archive build files.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sC9mAXV6yvpJ6footkwICw.jpeg" /><figcaption>Figure 26: Copy files on the server.</figcaption></figure><p>After setting up the agents now you have to select the “<em>Trigger</em>” tab and tick “<em>Enable</em> <em>Continuous integration</em>” this will enable the CI, whenever new code is pushed on the remote repository. Once this is done click on “<em>Save &amp; Queue</em>” it will trigger the CI and all the agents will run sequentially. If something fails in between the CI will stop with an error message and it will show which agent failed and what was the error. This method will reduce the risk of deploying a broken code to the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UmHMrJzM2nuy60AcfsL9Hw.png" /><figcaption>Figure 27: Enable CI.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zEwqjUugUj4uT1MO8yCRUQ.jpeg" /><figcaption>Figure 28: Successful Build.</figcaption></figure><p>Now the Build pipeline is ready let’s move towards the <strong>Release pipeline</strong>.</p><p>To start with release pipeline click on “<em>Releases</em>” after that click on “<em>New Pipeline</em>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MUeGknvmu37YJold41UK6A.png" /><figcaption>Figure 29: Release Pipeline.</figcaption></figure><p>After that select the “<em>Azure App Service Deployment</em>” agent and click on apply.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*taLJMiN6HF2jMgHyQHanyQ.png" /><figcaption>Figure 30: Select the Deployment Agent.</figcaption></figure><p>Now you need to add the artifact which you got from build pipeline. Click on “<em>Add an Artifact</em>”, select the build pipeline and click on “<em>Add</em>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Y3DGoISHGT1ssoa0Le4HA.png" /><figcaption>Figure 31: Select Artifact from Build pipeline.</figcaption></figure><p>After adding artifact you need to enable CD so that once the CI is passed successfully the CD will trigger automatically.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Tlqhru7opIdViZ3yotNKg.png" /><figcaption>Figure 32: Enable CD Trigger.</figcaption></figure><p>Now after enabling CD you need to select the “<em>Azure Subscription</em>” &amp; “<em>App Service name</em>” where the Build will be deployed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yz0gjQQzdSkMgnIrcIa7hw.png" /><figcaption>Figure 33: Select the Subscription &amp; App service name to deploy.</figcaption></figure><p>Now click the agent and click on three dots […] on the “<em>package &amp; folder</em>” option to select the build artifact.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HRb2Adk1v6HomK3YGQzQew.png" /><figcaption>Figure 34: Locating Artifact.</figcaption></figure><p>Click on “<em>ok</em>” after selecting the zip file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-SnS-GcmXLgyG-mIrrBkXg.png" /><figcaption>Figure 35: Select the Zip file location.</figcaption></figure><p>Now click on “<em>Save</em>” after that click on “<em>Create Release</em>” at last click on “<em>Create</em>” this will launch your Release pipeline.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tyrllQHkmgfuQMRhMlf5rA.png" /><figcaption>Figure 36: Release Pipeline.</figcaption></figure><p>After launching your release pipeline this will start deploying the build to the selected application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vmEl4BJ4WI9wHl23Wsf_Zg.jpeg" /><figcaption>Figure 37: Successful Deploy.</figcaption></figure><h4>Checking your application on the server.</h4><p>Now after successful release its time to check your application working on the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uY8QTvmkcVA7XGrBvrdxYQ.png" /><figcaption>Figure 38: Application Running in Server.</figcaption></figure><h4>Conclusion</h4><p>You have successfully deployed your angular application on the server using the CI/CD pipeline. CI/CD plays an important role in the industry to increase production, reduces the server downtimes and manual efforts.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c83df4c45a98" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>