Skip to content

Commit a97bb62

Browse files
committed
DevOps: Push DevOps-Project-10
* Create a CI/CD pipeline for .NET with the DevOps Starter Project Signed-off-by: NotHarshhaa <reddyharshhaa12@gmail.com>
1 parent cab78e0 commit a97bb62

File tree

1 file changed

+204
-0
lines changed

1 file changed

+204
-0
lines changed

DevOps Project-10/README.md

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
# Create a CI/CD pipeline for .NET with the DevOps Starter Project
2+
3+
![devops](https://imgur.com/gBofYCl.png)
4+
5+
## Overview
6+
7+
The **DevOps Starter Project** simplifies the setup of an entire continuous integration (CI) and continuous delivery (CD) pipeline to Azure with Azure DevOps. You can start with existing code or use one of the provided sample applications. Then you can quickly deploy that application to various Azure services such as Virtual Machines, App Service, Azure Kubernetes Services (AKS), Azure SQL Database and Azure Service Fabric.
8+
9+
DevOps Projects does all the work for the initial configuration of a DevOps pipeline including everything from setting up the initial Git repository, configuring the CI/CD pipeline, creating an Application Insights resource for monitoring, and providing a single view of the entire solution with the creation of a DevOps Projects dashboard in the Azure portal.
10+
11+
## What's covered in this lab?
12+
13+
In this lab, you will
14+
* Create an ASP.NET sample DevOps project using **DevOps Starter** feature in Azure
15+
* Examine the CI/CD pipelines configured by **DevOps Starter**
16+
* Commit the code changes and execute CI/CD
17+
* Configure Azure Application Insights monitoring
18+
19+
## Pre-requisites for the lab
20+
21+
1. **Microsoft Azure Account**: You will need a valid and active Azure account for the Azure labs. If you do not have one, you can sign up for a [free trial](https://azure.microsoft.com/en-us/free/)
22+
23+
* If you are a Visual Studio Active Subscriber, you are entitled for a $50-$150 credit per month. You can refer to this [link](https://azure.microsoft.com/en-us/pricing/member-offers/msdn-benefits-details/) to find out more including how to activate and start using your monthly Azure credit.
24+
25+
* If you are not a Visual Studio Subscriber, you can sign up for the FREE [Visual Studio Dev Essentials](https://www.visualstudio.com/dev-essentials/)program to create **Azure free account** (includes 1 year of free services, $200 for 1st month).
26+
27+
1. You will need an Azure DevOps account. If you do not have one, you can sign up for free [here](https://azure.microsoft.com/en-us/services/devops/).
28+
29+
30+
## Exercise 1: Setting up a sample ASP.NET project using DevOps Starter Project
31+
32+
33+
1. Sign into the [Microsoft Azure portal](https://portal.azure.com).
34+
35+
1. In the search box, type DevOps , and then select **DevOps Starter**. Then click on **Create DevOps Starter**
36+
37+
![searchdevopsproject](https://imgur.com/u3wYDXq.png)
38+
39+
![createdevopsproject](https://imgur.com/sWw6V7K.png)
40+
41+
1. By default DevOps Starter project setup with GitHub. Click on change settings **here** to change the destination to Azure DevOps and click **Done**
42+
43+
![](https://imgur.com/k6bIWYh.png)
44+
45+
46+
1. Now select the **.NET** sample application and click **Next**.
47+
48+
![selectdotnet](https://imgur.com/5rH5jO5.png)
49+
50+
51+
1. The .NET samples include a choice of either the open source ASP.NET framework or the cross-platform .NET Core framework. Select the .NET Core application framework. This sample is an ASP.NET Core MVC application. And also enable **Add a database** toggle to add the database to the application. When you’re done, choose Next.
52+
53+
![aspnetframework](https://imgur.com/TbnKU3b.png)
54+
55+
1. Web App on Windows is the default deployment target. You can optionally choose Virtual Machine also. When you're done, choose **Next**.
56+
57+
![selectwebapp](https://imgur.com/DEz6heC.png)
58+
59+
60+
1. Select your Azure DevOps organization and choose a name for your project and Web app. When you’re done, choose **Review + Create**.
61+
62+
![vstsproject](https://imgur.com/bmh1dRB.png)
63+
64+
65+
> You can click on **Additional Settings** if you would like to edit web app and database parameters
66+
67+
![vstsproject](https://imgur.com/1oZWOeE.png)
68+
69+
1. Once the deployment completes, click **Go to resource**.
70+
71+
![gotoresource](https://imgur.com/mZTL9rM.png)
72+
73+
1. DevOps project dashboard loads as shown in below image.
74+
75+
![dashboard](https://imgur.com/D7TarHD.png)
76+
77+
DevOps project
78+
- Created a team project with sample .NET code repository
79+
80+
- Created a build and release pipelines to compile, test and deploy the application
81+
82+
- Created Azure Web App and Azure SQL database in Azure using Azure Pipelines
83+
84+
>If Azure Resources are not created, they will be created by CI/CD pipeline. You can track pipeline status in 'CI/CD pipeline' section
85+
86+
You're now ready to collaborate with a team on an ASP.NET Core app with a CI/CD process that automatically deploys your latest work to your web site.
87+
88+
1. On the right side of the dashboard, select **Browse** to view your running application.
89+
90+
![browsewebapp](https://imgur.com/Mq8Jobx.png)
91+
92+
The web app looks like as shown in the below figure
93+
94+
![webapp](https://imgur.com/kYescHq.png)
95+
96+
97+
## Exercise 2: Examine the CI/CD pipelines configured by Azure DevOps Project
98+
The Azure DevOps Starter project automatically configured a full CI/CD pipeline in your Azure DevOps organization. You can explore and customize the pipeline as needed. Follow the steps below to familiarize yourself with the Azure DevOps build and release pipelines.
99+
100+
1. Select **Build Pipelines** from the top of the Azure DevOps project dashboard. This link opens a browser tab and the Azure DevOps build pipeline for your new project.
101+
102+
![buildpipelines](https://imgur.com/Nlqq4C4.png)
103+
104+
105+
1. Select **Edit**.
106+
107+
![editbuild](https://imgur.com/C3b5EOW.png)
108+
109+
1. In this pane, you can examine the various tasks for your build pipeline. This build pipeline performs various tasks such as fetching sources from the Git repository, restoring dependencies, compile the application, run tests and publishing outputs used for deployments.
110+
111+
![builddefinition](https://imgur.com/aZDERWo.png)
112+
113+
114+
1. Under your build pipeline name, select **History**. You see an audit trail of your recent changes for the build. Azure DevOps keeps track of any changes made to the build definition and allows you to compare versions.
115+
116+
117+
1. Select **Triggers**. The Azure DevOps project automatically created a CI trigger and every commit to the repository initiates a new build. You can optionally choose to include or exclude branches from the CI process.
118+
119+
![triggers](https://imgur.com/Jf2DXfV.png)
120+
121+
122+
1. Select **Releases** under **Pipelines** section.
123+
124+
![](https://imgur.com/gngkn7u.png)
125+
126+
The Azure DevOps project created a release pipeline to manage deployments to Azure.
127+
128+
129+
1. Select the release pipeline, then choose **Edit**.
130+
131+
![editrelease](https://imgur.com/U4zPUOV.png)
132+
133+
1. Under **Artifacts**, select **Drop**. The build pipeline you examined in the previous steps produces the output used for the artifact.
134+
135+
![releasedefinition](https://imgur.com/TnIU504.png)
136+
137+
1. To the right-hand side of the **Drop** icon, select the **Continuous deployment trigger**. This release pipeline has an enabled CD trigger, which executes a deployment every time there is a new build artifact available. Optionally, you can disable the trigger, when your deployments require manual execution.
138+
139+
![cdtrigger](https://imgur.com/yApjZXh.png)
140+
141+
142+
1. Select **Tasks**. The tasks are the activities your deployment process performs. In this example, you have five tasks.
143+
144+
![viewtasks](https://imgur.com/TrJrt80.png)
145+
146+
![releasetasks](https://imgur.com/GxVGj68.png)
147+
148+
- **Azure Resource Group Deployment** task deploy the required Azure resources, Azure Web app and Azure SQL database for the application to use.
149+
- **Azure App Service Deploy** task deploy the application package to the web site
150+
- **Azure SQL Database deployment** task deploy SQL changes to the database.
151+
- **Visual Studio Test** tasks run functional tests after the successful deployment of the application
152+
153+
1. On the right-hand side of the browser, select **View releases**. This view shows a history of releases.
154+
155+
![viewreleases](https://imgur.com/ncxoI0c.png)
156+
157+
158+
![releasehistory](https://imgur.com/Cl4OR0z.png)
159+
160+
1. Click on the release number to view the release summary. There are several menus to explore from this view such as a release summary, associated work items, and tests.
161+
162+
![releasesummary](https://imgur.com/XS3D8FE.png)
163+
164+
1. Select **Logs**. The logs contain useful information about the deployment process. They can be viewed both during and after deployments.
165+
166+
## Exercise 3: Commit the code changes and execute CI/CD
167+
168+
The Azure DevOps project created a Git repository in your Azure DevOps organization. Follow the steps below to view the repository and make code changes to your application.
169+
170+
1. Select **Repos** to view the created Git repository by Azure DevOps project.
171+
172+
![codetab](https://imgur.com/TLuKCD1.png)
173+
174+
1. To view the repository clone URL, select **Clone** from the top right of the browser. You can clone your Git repository in your favourite IDE. In this lab, you can use the web browser to make and commit code changes directly to the master branch.
175+
176+
![cloneurl](https://imgur.com/3NaFSlv.png)
177+
178+
1. On the left-hand side of the browser, navigate to the **Application/aspnet-core-dotnet-core/Pages/Index.cshtml** file. Select **Edit**, and make a change.
179+
180+
![addcode](https://imgur.com/JnGDV84.png)
181+
182+
Make a change to the h2 heading. For example, type **Get started right away with the Azure DevOps Projects** or make some other change. Choose **Commit**, to save and check-in your changes.
183+
184+
![addcode2](https://imgur.com/9HZSOYG.png)
185+
186+
187+
1. In your browser, navigate to the **Pipelines \| Pipelines**. You should now see a build is in progress. The changes you just made are automatically built and deployed via Azure DevOps CI/CD pipelines.
188+
189+
![buildqueue](https://imgur.com/lnRH7tF.png)
190+
191+
1. Once the Build and Release are completed in your browser, navigate to the **Azure DevOps project dashboard**. On the right side of the dashboard, select **Browse** to view your updated running application. You will see the updated header in the web app.
192+
193+
![browsewebapp](https://imgur.com/TQUxbBb.png)
194+
195+
![updatedsite](https://imgur.com/YSM4t43.png)
196+
197+
198+
# Thank you
199+
Thank you for taking the time to work on this tutorial/labs. Let me know what you thought!
200+
201+
202+
#### Author by [Harshhaa Reddy](https://github.com/NotHarshhaa)
203+
204+
Ensure to follow me on GitHub. Please star/share this repository!

0 commit comments

Comments
 (0)