Microsoft has updated Azureโs main PaaS services with the latest release of .NET. Hereโs the skinny on .NET 6 support in Azure Functions, Azure App Service, and Azure Static Web Apps.
The November 2021 launch of .NET 6 introduced the first Long Term Support (LTS) version of the new .NET Core-based unified platform. Supported until November 2024, .NET 6 is intended for production code that needs a stable foundation. You can build on .NET 6 now and be sure that your code wonโt need significant changes until after the launch of .NET 8.
As a result, itโs not surprising to see Azureโs main PaaS (platform-as-a-service) tools adopt .NET 6 very quickly, with immediate, โday zeroโ support in Azure Functions, Azure App Service, and Azure Static Web Apps. Weโll walk through the .NET 6 support in these popular Azure services below.
Moving to .NET 6 makes sense for Azure, as the previous LTS release, .NET Core 3.1, drops out of support at the end of 2022. With a year overlap, thereโs time to move your code to the current LTS release before support ends.
Build serverless functions with .NET 6
The most obvious .NET 6 transition comes with the release of Azure Functions 4.0. Microsoftโs serverless platform gets regular updates to add new versions of all its main runtimes. For Functions 4.0, these include Node.js 14 for JavaScript code, Python 3.7 and 3.9, Java 8 and 11, and the .NET Core 3.1-based PowerShell 7.0 (which will eventually be updated to the .NET 6-based PowerShell 7.2). With Azure Functions 4.0 the recommended runtime, you should consider it for all new code and as a target when updating existing applications.
Itโs important to remember you donโt have to move code right away. Applications running in Azure Functions 3.x will still work, though itโs a good idea to keep an eye on Azureโs service announcements to ensure that youโre not relying on a specific minor version thatโs being withdrawn. Azure Functions 1.x and 2.x are now in maintenance mode, which means they should only be used for existing code that requires specific .NET features and cannot be updated to run on newer releases.
Getting started with Azure Functions 4.0 shouldnโt be too difficult. Existing code written for Azure Functions 3.x will be based on either .NET Core 3.1 or .NET 5.0 and should migrate easily as thereโs a lot of backward compatibility between the two releases. Older code may require some work, especially if youโre moving from .NET Framework 4 to the new open source version. Upgrades will require first updating local development and test environments before upgrading your application on Azure.
Updating older .NET Azure Functions
Start by updating your codeโs TargetFramework and AzureFunctionsVersionย to support .NET 6 and Azure Functions 4.0. At the same time, update libraries and packages from NuGet to ensure youโre running compatible versions. In Azure, use the CLI to switch your target Azure Functions version for your application.
You donโt have to make this a big bang and update all of your applications at the same time. You can update different applications at different times or even create new major versions of applications if youโre using Azure Functions to host APIs (allowing you to add new features at the same time as upgrading .NET and Azure Functions releases). Although maintaining different versions of an API can add to your workload, it will allow you to gracefully deprecate older endpoints and help your users migrate to new versions.
Some breaking changesย affect moving from Azure Functions 3 to Azure Functions 4, mostly due to changes in the underlying .NET runtime. Some, like the removal of support for Aure Functions Proxies, require using alternate Azure services; others will require code or library changes. For example, Azure Functions now enforces minimum versions for extensions, so you will need to ensure that code is updated before being published to Azure.
One change that may cause some upset is the requirement to use separate storage accounts for apps that have the same computed hostname (usually as a result of their being too long and being automatically truncated, something on the order of 30% of apps running on Azure Functions 3), which can stop code from starting. In practice, it shouldnโt be too much of a problem, but it will now cause apps to error and fail, where previously it only generated a warning.
.NET 6 in Azure App Service
Azure Functions isnโt the only Azure PaaS to offer .NET 6 support. Azure App Service is using .NET 6 for its .NET-based tools. You can use Azure App Service to quickly roll out ASP.NET Core 6.0 application back ends, using familiar Visual Studio tools. Again, the advantage here is Long Term Support for your development and deployment environments, as well as cross-platform support for the .NET runtime so you can choose either Windows or Linux hosts for your code.
Thereโs support for both standard deployments with shared or self-contained runtimes and more portable container-based deployments. Choosing a self-contained deployment on Linux or Windows makes sense as youโre isolated from other applications, with your own runtime and libraries. However, you will need to make sure that youโre managing updates for your application, as this is no longer handled by Azure.
As Azure App Service is purely an ASP.NET host, youโll have to migrate existing code yourself, though that shouldnโt be too much of an issue. Microsoft provides a good set of migration instructions, both for ASP.NET Core 3.1 and ASP.NET 5. There are some breaking changes as part of the new release, but these are well documented, and it shouldnโt be too difficult to make the appropriate changes.
Using .NET 6 for WebAssembly in Azure Static Web Apps
The other Azure service that got an at-launch .NET 6 release was Azure Static Web Apps. Here things are a little different. Instead of running .NET 6 on Azureโs servers, youโre running on your usersโ browsers via .NET 6โs WebAssembly support using Blazor. Itโs perhaps best thought of as a complement to either Azure Functions or Azure App Service, providing a front end to Azure-hosted APIs.
Like other Azure Static Web Apps, youโre building locally, using GitHub for CI/CD (continuous integration and continuous delivery) and Azure for hosting. However, instead of Jamstack pages, your web content will host .NET 6 applications with full support for technologies such as Unoโs WebUI components. Visual Studioโs Blazor tools simplify the process of taking existing .NET applications and porting them to the web, and you can use ahead-of-time compilation to deliver bytecode directly to browsers rather than an entire .NET runtime. You can even use the free plan to build and test Blazor applications before moving to a paid tier.
Rapid rollout of .NET 6 in Azure is good for developers wanting to take advantage of the latest features. With Long Term Support, weโll see third parties and open source developers creating new libraries and components, ensuring that youโll get the tools you need to deliver the apps your users are expecting. As Microsoft and the .NET team roll out interim update releases, we should see Azure pick them up as quickly, using early-release mechanisms to seed early adopters and then wider rollouts as part of regular image and container updates.


