title | description | ms.prod | ms.technology | services | documentationcenter | author | manager | editor | ms.assetid | ms.workload | ms.tgt_pltfrm | ms.devlang | ms.topic | ms.date | ms.author | ms.custom | monikerRange |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Quickstart: Create a CI/CD pipeline for .NET with Azure DevOps Projects |
Azure DevOps Projects makes it easy to get started on Azure. It helps you launch a .NET app on an Azure service of your choice in few quick steps. |
devops |
devops-cicd |
azure-devops-project |
vs-devops-build |
mlearned |
douge |
web |
na |
na |
quickstart |
07/09/2018 |
mlearned |
mvc |
vsts |
Configure continuous integration (CI) and continuous delivery (CD) for your .NET core or ASP.NET application with DevOps Projects. DevOps Projects simplifies the initial configuration of a build and release pipeline in Azure Pipelines.
If you don't have an Azure subscription, you can get one free through Visual Studio Dev Essentials.
DevOps Projects creates a CI/CD pipeline in Azure DevOps. You can create a new Azure DevOps organization or use an existing organization. DevOps Projects also creates Azure resources in the Azure subscription of your choice.
-
Sign in to the Microsoft Azure portal.
-
In the left pane, select Create a resource icon in the left navigation bar, and then search for DevOps Projects.
-
Select Create.
-
Select the .NET sample application. 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. -
Select Next.
Web App on Windows is the default deployment target. Optionally, you can choose Web App on Linux or Web App for Containers. The application framework, which you chose previously, dictates the type of Azure service deployment target available here. -
Leave the default service, and then select Next.
-
Create a new free Azure DevOps organization or choose an existing organization.
a. Choose a name for your project.
b. Select your Azure subscription and location, choose a name for your application, and then select Done.
After a few minutes, the DevOps Projects dashboard is displayed in the Azure portal. A sample application is set up in a repository in your Azure DevOps organization, a build is executed, and your application is deployed to Azure. This dashboard provides visibility into your code repository, the CI/CD pipeline, and your application in Azure. -
On the right of the dashboard, select Browse to view your running application.
DevOps Projects created a Git repository in Azure Repos or GitHub. To view the repository and make code changes to your application, do the following:
-
On the left of the DevOps Projects dashboard, select the link for your master branch.
This link opens a view to the newly created Git repository. -
To view the repository clone URL, select Clone from the top right of the browser.
You can clone your Git repository in your favorite IDE. In the next few steps, you can use the web browser to make and commit code changes directly to the master branch. -
On the left of the browser, go to the Views/Home/index.cshtml file.
-
Select Edit, and then make a change to the h2 heading. For example, type Get started right away with the Azure DevOps Projects or make some other change.
-
Select Commit, and then save your changes.
-
In your browser, go to the Azure DevOps Project dashboard. You should now see a build is in progress. The changes you made are automatically built and deployed via a CI/CD pipeline.
In the previous step, Azure DevOps Projects automatically configured a full CI/CD pipeline. Explore and customize the pipeline as needed. Take the following steps to familiarize yourself with the Azure DevOps build and release pipelines.
-
At the top of the DevOps Projects dashboard, select Build Pipelines.
This link opens a browser tab and the Azure DevOps build pipeline for your new project. -
Select the ellipsis (...). This action opens a menu where you can start several activities such as queuing a new build, pausing a build, and editing the build pipeline.
-
Select Edit.
-
In this pane, you can examine the various tasks for your build pipeline.
The build performs various tasks, such as fetching sources from the Git repository, restoring dependencies, and publishing outputs used that are used for deployments. -
At the top of the build pipeline, select the build pipeline name.
-
Change the name of your build pipeline to something more descriptive, select Save & queue, and then select Save.
-
Under your build pipeline name, select History.
In the History pane, you see an audit trail of your recent changes for the build. Azure Pipelines keeps track of any changes that are made to the build pipeline, and it allows you to compare versions. -
Select Triggers.
DevOps Projects automatically created a CI trigger, and every commit to the repository starts a new build. You can optionally choose to include or exclude branches from the CI process. -
Select Retention.
Depending on your scenario, you can specify policies to keep or remove a certain number of builds. -
Select Build and Release, then select Releases.
DevOps Projects creates a release pipeline to manage deployments to Azure. -
On the left, select the ellipsis (...) next to your release pipeline, and then select Edit.
The release pipeline contains a pipeline, which defines the release process. -
Under Artifacts, select Drop. The build pipeline you examined in the previous steps produces the output used for the artifact.
-
Next to the Drop icon, select the Continuous deployment trigger.
This release pipeline has an enabled CD trigger, which runs a deployment every time there is a new build artifact available. Optionally, you can disable the trigger so that your deployments require manual execution. -
On the left, select Tasks.
The tasks are the activities that your deployment process performs. In this example, a task was created to deploy to Azure App Service. -
On the right, select View releases. This view shows a history of releases.
-
Select the ellipsis (...) next to one of your releases, and then select Open.
There are several menus to explore, such as a release summary, associated work items, and tests. -
Select Commits.
This view shows code commits that are associated with the specific deployment. -
Select Logs.
The logs contain useful information about the deployment process. They can be viewed both during and after deployments.
You can delete Azure App Service and other related resources that you created when you don't need them anymore. Use the Delete functionality on the DevOps Projects dashboard.
To learn more about modifying the build and release pipelines to meet the needs of your team, see this tutorial:
[!div class="nextstepaction"] Customize CD process