5

I am trying to deploy Azure functions using Azure DevOps. I have used terraform to create the required resources(Azure functions app) in Azure portal. As a next steps with the build and release pipeline I have deployed actual function code written in C#.

I am getting the below error:
Your app is pinned to an unsupported runtime version for 'dotnet'. For better performance, we recommend using one of our supported versions instead: ~3.

But when I create a function manually from the Azure portal I am not getting any warning.In this case also I am using Azure devops.

My build pipeline have simple tasks like selecting .NET core sdk(6.0.X) then dot net build using a *.csproj and archive and publish. These artifacts I am deploying in a release pipeline using Azure function task and selected deployment option as Zip deploy.

I tried both Zip deploy and Auto detect but both the cases I am getting the warning.

Why I am getting the warning? But for linux function I am not getting this kind of warning

.csproj code:

<Project Sdk="Microsoft.NET.Sdk">
 <PropertyGroup> 
<TargetFramework>net6.0</TargetFramework>
 <AzureFunctionsVersion>v4</AzureFunctionsVersion>
 <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
 </PropertyGroup>
 <ItemGroup>
 <PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
 <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.0" />
 </ItemGroup>

4 Answers4

5

Sounds like you need to add another entry in your azure web config

"netFrameworkVersion": "v6.0"

Credit: https://blog.sandro-pereira.com/2022/07/28/azure-function-app-issues-your-app-is-pinned-to-an-unsupported-runtime-version-for-dotnet-for-better-performance-we-recommend-using-one-of-our-supported-versions-instead-3/

Amir
  • 232
  • 3
  • 11
  • 1
    Long story short: Appart from updaing the runtime to v4 in your config, you also need to update the dotnet framework version used. Its using 4.0 by default instead of 6.0. Only adding this config did not work for me to upgrade the framework version. Follow the provided guide to upgrade your framework – Pieter Nov 02 '22 at 09:57
3

I didn't use Terraform, but found that after I used the Azure CLI to set the dotnet version, the message went away.

az functionapp config set --net-framework-version v6.0 -g <RESOURCE_GROUP_NAME> -n <APP_NAME>

AlignedDev
  • 8,102
  • 9
  • 56
  • 91
0

Your error message is related with the function runtime version. Currently, Azure Function runtime ~4 is recommended for running .NET 6.0 according to the docs.

You will need to specify the function runtime version ~4 in your Terraform manifest. This can be achieved using functions_extension_version argument for the azurerm_windows_function_app resource.

As of azurerm provider 3.11.0, default functions_extension_version argument already defaults to ~4. So, in case you are using the latest provider version, you can either remove the current functions_extension_version = "~3" setting or update it with the version ~4.

iddqdiddqd
  • 31
  • 2
  • 5
-2

I am using terraform, and the config files are here for you to see and the specific file is this.

As you can see the FUNCTIONS_EXTENSION_VERSION is assigned "~4".

app_settings = {
  "WEBSITE_RUN_FROM_PACKAGE"       = "",
  "FUNCTIONS_WORKER_RUNTIME"       = "dotnet"
  "APPINSIGHTS_INSTRUMENTATIONKEY" = azurerm_application_insights.application_insights.instrumentation_key,
  FUNCTIONS_EXTENSION_VERSION      = "~4"
}

And because of this I get the following message.

Your app is pinned to an unsupported runtime version for 'dotnet'. For better performance, we recommend using one of our supported versions instead: ~3.

Function App Configuration1

And the same image zoomed.

Function App Configuration2

So I changed

FUNCTIONS_EXTENSION_VERSION      = "~4"

to

FUNCTIONS_EXTENSION_VERSION      = "~3"

Now this fixed this issues.

Function App Configuration3

VivekDev
  • 20,868
  • 27
  • 132
  • 202