Cookie Consent by Free Privacy Policy Generator ๐Ÿ“Œ Setting up Azure DevOps CI/CD for a .NET Core 3.1 Web App hosted in Azure App Service for Linux

๐Ÿ  Team IT Security News

TSecurity.de ist eine Online-Plattform, die sich auf die Bereitstellung von Informationen,alle 15 Minuten neuste Nachrichten, Bildungsressourcen und Dienstleistungen rund um das Thema IT-Sicherheit spezialisiert hat.
Ob es sich um aktuelle Nachrichten, Fachartikel, Blogbeitrรคge, Webinare, Tutorials, oder Tipps & Tricks handelt, TSecurity.de bietet seinen Nutzern einen umfassenden รœberblick รผber die wichtigsten Aspekte der IT-Sicherheit in einer sich stรคndig verรคndernden digitalen Welt.

16.12.2023 - TIP: Wer den Cookie Consent Banner akzeptiert, kann z.B. von Englisch nach Deutsch รผbersetzen, erst Englisch auswรคhlen dann wieder Deutsch!

Google Android Playstore Download Button fรผr Team IT Security



๐Ÿ“š Setting up Azure DevOps CI/CD for a .NET Core 3.1 Web App hosted in Azure App Service for Linux


๐Ÿ’ก Newskategorie: Programmierung
๐Ÿ”— Quelle: feeds.hanselman.com

Following up on my post last week on moving from App Service on Windows to App Service on Linux, I wanted to make sure I had a clean CI/CD (Continuous Integration/Continuous Deployment) pipeline for all my sites. I'm using Azure DevOps because it's basically free. You get 1800 build minutes a month FREE and I'm not even close to using it with three occasionally-updated sites building on it.

Last Post: I updated one of my websites from ASP.NET Core 2.2 to the latest LTS (Long Term Support) version of ASP.NET Core 3.1 this week. I want to do the same with my podcast site AND move it to Linux at the same time. Azure App Service for Linux has some very good pricing and allowed me to move over to a Premium v2 plan from Standard which gives me double the memory at 35% off.

Setting up on Azure DevOps is easy and just like signing up for Azure you'll use your Microsoft ID. Mine is my gmail/gsuite, in fact. You can also login with GitHub creds. It's also nice if your project makes NuGet packages as there's an integrated NuGet Server that others can consume libraries from downstream before (if) you publish them publicly.

Azure DevOps

I set up one of my sites with Azure DevOps a while back in about an hour using their visual drag and drop Pipeline system which looked like this:

Old Pipeline Style

There's some controversy as some folks REALLY like the "classic" pipeline while others like the YAML (Yet Another Markup Language, IMHO) style. YAML doesn't have all the features of the original pipeline yet, but it's close. It's primary advantage is that the pipeline definition exists as a single .YAML file and can be checked-in with your source code. That way someone (you, whomever) could import your GitHub or DevOps Git repository and it includes everything it needs to build and optionally deploy the app.

The Azure DevOps team is one of the most organized and transparent teams with a published roadmap that's super detailed and they announce their sprint numbers in the app itself as it's updated which is pretty cool.

When YAML includes a nice visual interface on top of it, it'll be time for everyone to jump but regardless I wanted to make my sites more self-contained. I may try using GitHub Actions at some point and comparing them as well.

Migrating from Classic Pipelines to YAML Pipelines

If you have one, you can go to an existing pipeline in DevOps and click View YAML and get some YAML that will get you most of the way there but often includes some missing context or variables. The resulting YAML in my opinion isn't going to be as clean as what you can do from scratch, but it's worth looking at.

In decided to disable/pause my original pipeline and make a new one in parallel. Then I opened them side by side and recreated it. This let me learn more and the result ended up cleaner than I'd expected.

Two pipelines side by side

The YAML editor has a half-assed (sorry) visual designer on the right that basically has Tasks that will write a little chunk of YAML for you, but:

  • Once it's placed you're on your own
    • You can't edit it or modify it visually. It's text now.
  • If your cursor has the insert point in the wrong place it'll mess up your YAML
    • It's not smart

But it does provide a catalog of options and it does jumpstart things. Here's my YAML to build and publish a zip file (artifact) of my podcast site. Note that my podcast site is three projects, the site, a utility library, and some tests. I found these docs useful for building ASP.NET Core apps.

  • You'll see it triggers builds on the main branch. "Main" is the name of my primary GitHub branch. Yours likely differs.
  • It uses Ubuntu to do the build and it builds in Release mode. II
  • I install the .NET 3.1.x SDK for building my app, and I build it, then run the tests based on a globbing *tests pattern.
  • I do a self-contained publish using -r linux-x64 because I know my target App Service is Linux (it's cheaper) and it goes to the ArtifactStagingDirectory and I name it "hanselminutes." At this point it's a zip file in a folder in the sky.

Here it is:

trigger:

- main

pool:
vmImage: 'ubuntu-latest'

variables:
buildConfiguration: 'Release'

steps:
- task: UseDotNet@2
displayName: ".NET Core 3.1.x"
inputs:
version: '3.1.x'
packageType: sdk

- task: UseDotNet@2
inputs:
version: '3.1.x'
- script: dotnet build --configuration $(buildConfiguration)
displayName: 'dotnet build $(buildConfiguration)'

- task: DotNetCoreCLI@2
displayName: "Test"
inputs:
command: test
projects: '**/*tests/*.csproj'
arguments: '--configuration $(buildConfiguration)'

- task: DotNetCoreCLI@2
displayName: "Publish"
inputs:
command: 'publish'
publishWebProjects: true
arguments: '-r linux-x64 --configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
zipAfterPublish: true

- task: PublishBuildArtifacts@1
displayName: "Upload Artifacts"
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'hanselminutes'

Next I move to the release pipeline. Now, you can also do the actual Azure Publish to a Web App/App Service from a YAML Build Pipeline. I suppose that's fine if your site/project is simple. I wanted to have dev/test/staging so I have a separate Release Pipeline.

The Release Pipelines system in Azure DevOps can pull an "Artifact" from anywhere - GitHub, DevOps itself natch, Jenkins, Docker Hub, whatever. I set mine up with a Continuous Deployment Trigger that makes a new release every time a build is available. I could also do Releases manually, with specific tags, scheduled, or gated if I'd liked.

Continuous Deployment Trigger

Mine is super easy since it's just a website. It's got a single task in the Release Pipeline that does an Azure App Service Deploy. I can also deploy to a slot like Staging, then check it out, and then swap to Production later.

There's nice integration between Azure DevOps and the Azure Portal so I can see within Azure in the Deployment Center of my App Service that my deployments are working:

Azure Portal and DevOps integration

I've found this all to be a good use of my staycation and even though I'm just a one-person company I've been able to get a very nice automated build system set up at very low cost (GitHub free account for a private repo, 1800 free Azure DevOps minutes, and an App Service for Linux plan) A basic starts at $13 with 1.75Gb of RAM but I'm planning on moving all my sites over to a single big P1v2 with 3.5G of RAM and an SSD for around $80 a month. That should get all of my ~20 sites under one roof for a price/perf I can handle.


Sponsor: Like C#? We do too! Thatโ€™s why we've developed a fast, smart, cross-platform .NET IDE which gives you even more coding power. Clever code analysis, rich code completion, instant search and navigation, an advanced debugger... With JetBrains Rider, everything you need is at your fingertips. Code C# at the speed of thought on Linux, Mac, or Windows. Try JetBrains Rider today!



ยฉ 2019 Scott Hanselman. All rights reserved.
ย ย ย ย ย 
...



๐Ÿ“Œ Setting up Azure DevOps CI/CD for a .NET Core 3.1 Web App hosted in Azure App Service for Linux


๐Ÿ“ˆ 70.79 Punkte

๐Ÿ“Œ Working with Azure DevOps using the Azure DevOps CLI | The DevOps Lab


๐Ÿ“ˆ 40.04 Punkte

๐Ÿ“Œ what are competitive alternatives of .NET Core, ASP.NET Core, and EF Core for development/deployment on Linux?


๐Ÿ“ˆ 33.86 Punkte

๐Ÿ“Œ Microsoft ASP.NET Core/.NET Core Web Request denial of service


๐Ÿ“ˆ 31.78 Punkte

๐Ÿ“Œ Microsoft ASP.NET Core/.NET Core Web Request Denial of Service


๐Ÿ“ˆ 31.78 Punkte

๐Ÿ“Œ Microsoft .NET Maze: Understand .NET Core Vs .NET Framework Vs ASP.NET


๐Ÿ“ˆ 31.51 Punkte

๐Ÿ“Œ .NET Core and .NET Framework - what to choose? [1 of 3] | Desktop and .NET Core 101


๐Ÿ“ˆ 31.44 Punkte

๐Ÿ“Œ .NET Core, ASP.NET Core und Entity Framework Core 2.1 sind fertig


๐Ÿ“ˆ 31.37 Punkte

๐Ÿ“Œ Deploying a MSDeploy-packaged Web application to a Linux Azure App Service with Azure DevOps


๐Ÿ“ˆ 31.24 Punkte

๐Ÿ“Œ DevOps with Azure GitHub and Azure DevOps | INT164C


๐Ÿ“ˆ 30.02 Punkte

๐Ÿ“Œ Lessons learned: Migrating from AWS-Hosted PostgreSQL RDS to Self-Hosted Citus | Citus Con 2023


๐Ÿ“ˆ 29.29 Punkte

๐Ÿ“Œ Microsoft ASP.NET Core/.NET Core Web Request spoofing


๐Ÿ“ˆ 29.04 Punkte

๐Ÿ“Œ Microsoft ASP.NET Core/.NET Core Web Request privilege escalation


๐Ÿ“ˆ 29.04 Punkte

๐Ÿ“Œ Updating an ASP.NET Core 2.2 Web Site to .NET Core 3.1 LTS


๐Ÿ“ˆ 29.04 Punkte

๐Ÿ“Œ Microsoft ASP.NET Core/.NET Core Web Request Spoofing [CVE-2017-0256]


๐Ÿ“ˆ 29.04 Punkte

๐Ÿ“Œ Microsoft ASP.NET Core/.NET Core Web Request erweiterte Rechte


๐Ÿ“ˆ 29.04 Punkte

๐Ÿ“Œ Microsoft ASP.NET Core/.NET Core System.IO.Pipelines denial of service


๐Ÿ“ˆ 27.87 Punkte

๐Ÿ“Œ Kalenderwoche 44/2018 fรผr Entwickler im Rรผckblick: Artificial Intelligence, ASP.NET Core 3.0, Azure DevOps und mehr


๐Ÿ“ˆ 27.57 Punkte

๐Ÿ“Œ Azure DevOps for .NET Core & Cloud Native Apps | Cloud Native


๐Ÿ“ˆ 27.57 Punkte

๐Ÿ“Œ Azure DevOps for .NET Core & Cloud Native Apps


๐Ÿ“ˆ 27.57 Punkte

๐Ÿ“Œ Mobile DevOps with Xamarin, App Center and Azure DevOps | Xamarin Developer Summit


๐Ÿ“ˆ 27.13 Punkte

๐Ÿ“Œ Revitalizing Legacy .NET Apps: Upgrading From .NET 4.7 to .NET 7 With the .NET Upgrade Assistant Tool


๐Ÿ“ˆ 25.26 Punkte

๐Ÿ“Œ What is the difference between NET Core, NET 5 and NET Framework? | One Dev Question


๐Ÿ“ˆ 25.19 Punkte

๐Ÿ“Œ ASP.NET Core 3.0 lรคuft nur noch auf .NET Core


๐Ÿ“ˆ 25.13 Punkte

๐Ÿ“Œ .NET Core und ASP.NET Core 2.2.0 Preview 3 verfรผgbar


๐Ÿ“ˆ 25.13 Punkte

๐Ÿ“Œ ASP.NET Core and Blazor updates in .NET Core 3.0 Preview 6


๐Ÿ“ˆ 25.13 Punkte

๐Ÿ“Œ ASP.NET Core and Blazor updates in .NET Core 3.0 Preview 7


๐Ÿ“ˆ 25.13 Punkte

๐Ÿ“Œ ASP.NET Core and Blazor updates in .NET Core 3.0 Preview 8


๐Ÿ“ˆ 25.13 Punkte

๐Ÿ“Œ 4021279 - Vulnerabilities in .NET Core, ASP.NET Core Could Allow Elevation of Privilege - Version: 1.1


๐Ÿ“ˆ 25.13 Punkte

๐Ÿ“Œ ASP.NET Core and Blazor updates in .NET Core 3.0 Preview 9


๐Ÿ“ˆ 25.13 Punkte

๐Ÿ“Œ Visual Studio for Mac + ASP.NET Core โ€“ Getting started with ASP.NET Core using eShopOnWeb


๐Ÿ“ˆ 25.13 Punkte

๐Ÿ“Œ ASP.NET Core updates in .NET Core 3.1 Preview 2


๐Ÿ“ˆ 25.13 Punkte

๐Ÿ“Œ Announcing a Microsoft .NET Core and ASP.NET Core Bug Bounty


๐Ÿ“ˆ 25.13 Punkte

๐Ÿ“Œ ASP.NET Core and Blazor updates in .NET Core 3.0 Release Candidate 1


๐Ÿ“ˆ 25.13 Punkte

๐Ÿ“Œ ASP.NET Core updates in .NET Core 3.1 Preview 3


๐Ÿ“ˆ 25.13 Punkte











matomo