.NET 7 comes to Azure Functions & Visual Studio 2022

Melony Qin

NOTE: This blog was originally posted to the Apps on Azure blog for the initial preview and Visual Studio 2022 support.

We’re thrilled to announce that Azure Functions v4 now supports .NET 7 as runtime. Azure Functions joins Azure Web Apps who also announced .NET 7 support.

For those developers who are looking into building serverless functions in Azure with the latest innovation from .NET runtime, this makes it possible for all developers on the planet to focus on coding with .NET 7 new features, ready-to-code while on a large scale without worrying about the underlying infrastructure.

What’s new in .NET 7 with Azure Functions

You can now build your serverless applications with .NET 7 in Azure Functions using the .NET Isolated Worker model, which provides an isolation model that decouples your function process from the Azure Functions runtime, bringing the flexibility needed to target different versions of .NET, more efficiently manage dependencies and service registration.

The isolated worker model also allows you to use current .NET behaviors for dependency injection and incorporating middleware into your function app. Choose the isolated model if you’re upgrading from .NET 5 Azure functions v3. This feature is available for preview in all Windows & Linux-based plans in addition to premium plans.

How to try it out?

There’s no difference as you’re used to create an Azure function in .NET 7 runtime in an isolated process. We have core tools available to create a new Azure function in .NET 7 and support in Visual Studio 2022 17.4 Preview 1.

Azure Functions Core tools

To get started, we could leverage Azure Functions Core Tools to scaffold an isolated project folder structure as follows:

func init --worker-runtime dotnet-isolated --target-framework net7.0

Then use func new command to scaffold an HTTP trigger function. The following is an example command to create a function called DotNet7function using an HTTP trigger:

func new --name DotNet7Function --template "HTTP trigger"

And then you can use the func start command to test out this function.

func start

Visual Studio 2022

Visual Studio makes it easier for all developers to build serverless applications with Azure functions by streamlining the function creation workflow, with rich local development and debugging experience, and quickly publishing your .NET applications to Microsoft Azure.

Update your Visual Studio 2022 to 17.4 Preview 1.0

Follow the Visual Studio update process on the official documentation, and ensure you’re compliant with all the prerequisites before you update. Note that, you need to set your update channel to Preview in your More -> Update settings from Visual Studio Installer as the following:

Update Settings in Visual Studio

Make sure you have set the Modify -> Individual Component to include .NET 7 SDK ( Preview ), and .NET 7.0 Runtime ( Preview ):

Install .NET 7 Preview in Visual Studio

Create your Azure Functions

When you create a new Azure Function in Visual Studio where you’ll find a new option for .NET 7 Isolated:

Create a .NET 7 Function

Deploy your Azure Functions

Visual Studio provides a simple way to publish your application to Microsoft Azure. You can deploy your serverless application to Azure by simply right-clicking on your functions application in Visual Studio and then Publish. Select your publish target and publish your functions to Azure:

Deploy an Azure Function

Next steps

We’re looking forward to hearing your feedback and your use cases, please feel free to share them on announcement related discussions. Also, if you discover potential issues, please record them on the Azure Functions .NET language worker GitHub repository.

Coming up, we’re also closely collaborating with the community and ensuring your voices are heard, check out our public-facing product roadmap from: http://aka.ms/af-dotnet-roadmap.

Start to build your serverless applications with .NET 7, check out the official documentation:

If you are interested in learning more about Azure Functions v4, be sure to watch the recent On .NET episode with Matthew Henderson & Fabio Cavalcante from the Azure Function team.

We’re excited about the road ahead with the continued innovation from .NET on Azure functions.


Discussion is closed. Login to edit/delete existing comments.

  • David Petric 0


    Really interested about more information regarding integration testing and WebApplicationFactory, TestServer alternatives for in memory testing from Asp.Net Core, as we are trying and use Azure Functions we use the in-process model.. for APIs. I managed to setup my own startup classes and setup a in memory database, but couldn’t find a nice way to setup a HttpClient in memory, as solution offered for Asp.Net core.


    • Melony QinMicrosoft employee 0

      Thanks David, great feedback ! let me take this back to the team.

  • Tony Henrique 0

    I am creating a new Azure Function on the Azure Portal, region: Brazil South, https://portal.azure.com/#create/Microsoft.FunctionApp ,
    select runtime stack .NET, but only version 6 and 3.1 are listed, no 7.

    • Melony QinMicrosoft employee 0

      Hi Tony, For the portal experience will be coming soon, stay tuned! In the meantime, you can use Visual Studio / VS Code to publish to your existing Functions App, which will update the runtime setting automatically!

  • ks-beataim 9

    There’s no NET 7 SDK ( Preview ) in VS installer (only runtime). Thus no NET 7 function to select when creating a project…

Feedback usabilla icon