In this lab, we setup our DevOps Project in Azure to create our CI/CD pipeline. This will provide us with a standard code base to work with.
Based on this tutorial.
- Complete the Prerequisites lab.
-
Go to your Azure Portal and create a new DevOps Project. Make sure it meets the following demands:
- .NET Runtime
- ASP.NET Core application
- Linux Web App
- Linked to your existing Azure DevOps account
-
When the azure resources are created, go to your Azure DevOps account and make sure that:
- The first Build and Release are successful
- The App is deployed and accessable
-
Clone your code repository to your development environment and open your solution in Visual Studio:
- Upgrade all projects to ASP.NET Core 2.1 (Right-click project > Properties)
- Update all NuGet packages to their 2.x counterparts (Right-click project > Manage NuGet packages > Select all packages > Update)
- Add NuGet package to the web project: "Microsoft.NET.Sdk.Razor"
-
Unload the web project and unit test project. Make the following change to both project files:
- Remove the line
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
-
Set the functional tests to be ignored (this will be enabled in another lab).
In the FunctionalTests project, make the following change:SampleFunctionalTests.cs [Ignore] // <-- ignore test public void SampleFunctionalTest1()
-
Reload all the projects, build your solution and run the unit tests. Make sure that the unit tests pass
-
Open the folder "ArmTemplates" in your source, and edit the file "linux-webapp-template.json":
- Change the dotnetcore version to 2.1:
"linuxFxVersion": { "type": "string", "defaultValue": "dotnetcore|2.1" },
-
Go to your Azure Devops project site and edit the Release definition
-
Push your code to trigger a build/release
-
When the Release is finished, visit your web app url to verify it is still working
- Add custom logging to Application Insights through your Web App
Return to the lab index and continue with the next lab.
