Q&A

Building and Deploying a .NET 9 App Using Azure, Bicep and GitHub Actions

.NET 9 and its ASP.NET Core 9 web-dev framework are coming in November with the latest technology and tools for building modern web apps.

And these days, that usually means leveraging the cloud and DevOps, which for .NET-centric developers often means working with Azure, Bicep and GitHub Actions.

The latter helps automate various stages of the software development process directly within GitHub. "With GitHub Actions for Azure, you can create workflows that you can set up in your repository to build, test, package, release, and deploy to Azure," says Microsoft documentation. "GitHub Actions for Azure supports Azure services, including Azure App Service, Azure Functions, and Azure Key Vault."

Those workflows are made up of individual actions that are triggered by specific events, such as a pull request. There are a host of actions available, ranging from "Deploy Bicep file or Azure Resource Manager template" to "Trigger an Azure Pipelines run."

Infrastructure as Code with GitHub Actions
[Click on image for larger view.] Infrastructure as Code with GitHub Actions (source: Microsoft).

Bicep, meanwhile, is a domain-specific language used to simplify the authoring of Azure Resource Manager (ARM) templates. It provides a more readable and maintainable way to define Azure infrastructure, which can be deployed and managed through or GitHub Actions orAzure DevOps.

Bicep Processing
[Click on image for larger view.] Bicep Processing (source: Microsoft).

Microsoft says the advantages of Bicep include:

  • Support for all resource types and API versions: Bicep immediately supports all preview and GA versions for Azure services. As soon as a resource provider introduces new resource types and API versions, you can use them in your Bicep file. You don't have to wait for tools to be updated before using the new services.
  • Simple syntax: When compared to the equivalent JSON template, Bicep files are more concise and easier to read. Bicep requires no previous knowledge of programming languages. Bicep syntax is declarative and specifies which resources and resource properties you want to deploy.

So, while there are a lot of moving pieces to building and deploying a modern .NET 9 app using these tools, getting a handle on the whole picture and actually getting started can be difficult.

With that in mind, Scott Sauber, a software consultant who primarily does web development using ASP.NET Core and JavaScript, will explain everything in a full-day hands-on workshop titled "Building and Deploying a .NET 9 App Using Azure, Bicep, and GitHub Actions" during the huge Live 360! developer conference in Orlando, set for Nov. 17-22.

The event brings together in one venue five conferences, including Visual Studio Live! and TechMentor, for a week of training, education and networking, with other conferences focusing on Data Platform, Artificial Intelligence, Cloud & Containers and Cybersecurity & Ransomware.

Sauber's workshop is scheduled for Nov. 18, 2024, from 8:30 a.m. to 5:30 p.m. and will cover:

  • Using Bicep to provision the infrastructure
  • Using GitHub Actions to deploy the app
  • Learning how App Service works
  • Configuring Zero Downtime Deployments with Deployment Slots
  • Setting up Health Checks in ASP.NET Core
  • Setting up Logging and Instrumentation
  • Integration with Azure Key Vault for secret management

We caught up with Sauber, who in his day job is Director of Engineering at Lean TECHniques Inc., to get a preview of his workshop in a short Q&A.

VisualStudioMagazine: What inspired you to present a session on this topic?
Sauber: As part of my job at work, I get to work with lots of different clients. I often see clients struggle creating Continuous Integration and Continuous Delivery (CI/CD) pipelines that stitch all of these things together. You need your CI/CD pipeline with GitHub Actions to be able to authenticate securely and talk to Azure. You need to (or should be) deploying your infrastructure as code using a tool like Bicep, rather than configuring things manually in the Azure portal. And finally there are some things you can put in your .NET app in order to properly leverage Azure for things like observability, zero downtime deployments, and other things that are becoming table stakes for modern applications these days.

"The goal of this workshop is to decompose each one of those things to their core, teach the fundamentals, and then teach how they all fit together to create one cohesive pipeline."

Scott Sauber, Director of Engineering, Lean TECHniques Inc.

The goal of this workshop is to decompose each one of those things to their core, teach the fundamentals, and then teach how they all fit together to create one cohesive pipeline.

How does Bicep simplify the infrastructure provisioning process for Azure App Service?
Bicep is an Infrastructure as Code tool that is built and maintained by Microsoft, so it's a first-party tool. Infrastructure as Code allows you to have consistent and repeatable environments, so that your Production environment closely matches your non-Production environments. This is done by configuring Azure App Service using the Bicep language, which is essentially just a set of configuration files. Moreover, Bicep can be used to enforce standards across the enterprise ranging from things like security to naming standards.

Inside the Session

What: Hands-on Workshop: Building and Deploying a .NET 9 App Using Azure, Bicep, and GitHub Actions

When: Nov. 18, 2024, 8:30 a.m. - 5:30 p.m.

Who: Scott Sauber, Director of Engineering, Lean TECHniques Inc.

Why: Learn the soup to nuts on deploying an ASP.NET Core 9 API to Azure App Service using Bicep and GitHub Actions.

Find out more about Live 360! taking place Nov. 17-22 at Universal Orlando

What are the main benefits of using GitHub Actions for deployment in a .NET environment?
Many .NET developers are familiar with using GitHub for storing their source code, doing code reviews using Pull Requests, and so on. GitHub Actions is a Continuous Integration (CI) and Continuous Delivery (CD) tool that allows you to take your source code, validate it works (CI), and deploy it to your end users (CD). By leveraging GitHub Actions for CI/CD when you're already using GitHub for source control, you get a tight integration that allows you to track work from the idea phase to the coding phase to getting it deployed to users. GitHub also has a rich community that provides a lot of Actions for common, every day stuff that you might want to do.

What specific challenges might developers face when setting up health checks in ASP.NET Core, and how can they be mitigated?
There are a lot of pitfalls when it comes to health checks, many are subtle. For instance some people will choose to health check all their dependent services. This is all well and good, but depending on how your health check is implemented, you might restart or take down your entire app simply because some external service is down that only affects a small feature set of your application. Now you've taken down your entire application instead of gracefully failing on the subset of features that temporarily don't work. Instead what we can do is check just that the app is up and available and leverage that with zero downtime deployments to ensure a safe and seamless migration to the new code that was just deployed.

Can you describe the hands-on lab activities planned for this workshop?
Attendees will get hands on with all of the technology listed. They will be setting up their Azure account, learning some tips and tricks in Azure, creating Bicep files, and creating their GitHub Action pipelines to deploy the .NET app all the way out to Azure.

This workshop is labeled as introductory. Who is the ideal participant for this workshop, and what prior knowledge, if any, should they have?
Ideally, attendees should have some basic knowledge of C# and ASP.NET Core, but no other knowledge is required for this workshop. However, even if someone isn't a C# developer and is more of an operations person, I think they could still stand to benefit a lot from this workshop when we are talking about the Azure, Bicep and GitHub Actions part of this workshop.

Note: Those wishing to attend the conference can save hundreds of dollars by registering early, according to the event's pricing page. "Save $500 when you Register by Friday, Aug. 16!" said the organizer of the event, which is presented by the parent company of Visual Studio Magazine.

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus

Featured

  • Get Up and Running with Modern Angular

    The Angular web-dev framework might seem an odd choice for a Microsoft-centric developer to consider, seeing as it's championed by arch-rival Google, but a closer look reveals many advantages.

  • VS Code Experiments Boost AI Copilot Functionality

    Devs can now customize code generation, enjoy enhanced Chat experiences and much more.

  • AdaBoost Binary Classification Using C#

    Dr. James McCaffrey from Microsoft Research presents a C# program that illustrates using the AdaBoost algorithm to perform binary classification for spam detection. Compared to other classification algorithms, AdaBoost is powerful and works well with small datasets, but is sometimes susceptible to model overfitting.

  • From Core to Containers to Orchestration: Modernizing Your Azure Compute

    The cloud changed IT forever. And then containers changed the cloud. And then Kubernetes changed containers. And then microservices usurped monoliths, and so it goes in the cloudscape. Here's help to sort it all out.

Subscribe on YouTube