The V2 Runtime of Azure Functions was made generally available several weeks ago. Its most notable feature is that it’s based on the .NET Core runtime rather than the .NET Framework runtime. The switch to .NET Core means that Functions built for the V1 runtime can’t run in the V2 runtime.
Creating new Function Apps in the Azure Portal now deploys V2 Function Apps by default, and there’s no way to change it to the V1 runtime from the resource creation screen. There are two workarounds that you can use:
- Create the Function App normally, then downgrade it to the V1 runtime. You can change the runtime through the Configuration screen of the Function App by changing the FUNCTIONS_EXTENSION_VERSION key to ~1.
- Create the Function App via a resource template. The template can specify the V1 runtime directly.
Use of the template is seen as a best practice because it makes it easy to automate the creation of the Function App with a Continuous Deployment pipeline. But there are often cases when you want to spin up a new Function App directly. Creating them through the Azure Portal lets you do just that.
There’s a few reasons why creating V1 runtime Functions continues to make sense:
- To keep all your Functions executing on the same runtime.
- To let the V2 runtime mature a while longer.
- To keep your Functions in line with the rest of a stack that is built on .NET Framework.
That said, you should start planning a move to the V2 runtime in the near future since it’s unclear how long Microsoft will continue to support V1. When the time comes to end-of-life V1 Functions, I hope they’ll follow a deprecation model similar to the following:
- Start by disabling the creation of new V1 Function Apps. Continue to allow updates to existing V1 Function Apps.
- After a period of six months, disable the update of existing V1 Function Apps, but let them continue running.
- Finally, after another six months, disable the V1 runtime entirely.
This approach gives developers a reasonable amount of time to get their feet wet with the V2 runtime. It also provides the flexibility to fix bugs for existing V1 Function Apps whilst also promoting the usage of the V2 runtime.