当我使用Terraform时

发布于 2025-02-11 16:31:44 字数 1048 浏览 2 评论 0 原文

我正在尝试使用Azure DevOps部署Azure功能。 我已经使用Terraform在Azure Portal中创建所需的资源(Azure函数应用程序)。 作为构建和释放管道的下一步,我已经部署了用C#编写的实际功能代码。

我收到以下错误:
您的应用程序固定在“ dotnet”的不支持的运行时版本中。为了获得更好的性能,我们建议使用我们的支持版本之一:〜3。

但是当我从Azure门户手动创建功能时,我不会收到任何警告。在这种情况下,我也正在使用Azure Devops。

我的构建管道具有简单的任务,例如选择.NET Core SDK(6.0.x),然后使用 *.csproj和Archive and Publish Dot Net构建。这些工件我正在使用Azure功能任务和选定的部署选项作为ZIP部署在发行管道中部署。

我尝试了ZIP部署和自动检测,但我收到警告的两种情况。

为什么我会得到警告?但是对于Linux函数,我没有得到这种警告

.csproj 代码:

<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>

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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

冬天旳寂寞 2025-02-18 16:31:44

我没有使用Terraform,但是在我使用Azure CLI设置DotNet版本之后,消息就消失了。

AZ functionApp配置集-NET-FRAMEWORK-VERSION V6.0 -G&lt; resource_group_name&gt; -n&lt; app_name&gt;

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>

我的黑色迷你裙 2025-02-18 16:31:44

您的错误消息与功能运行时版本有关。目前,建议使用.NET 6.0 根据文档

您需要在Terraform清单中指定功能运行时版 〜4 。可以使用 functions_extension_version azurerm_windows_function_app 资源来实现这一点。

作为Azurerm提供商3.11.0,默认 functions_extension_version 参数已经默认为 〜4 。因此,如果您使用最新的提供商版本,则可以删除当前 function_extension_version =“ 〜3” 设置或使用版本 〜4 进行更新。

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.

会傲 2025-02-18 16:31:44

我正在使用Terraform,而配置文件为在这里让您看到特定文件是此

如您所见,分配了 functions_extension_version “ 〜4”。

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

因此,我收到以下消息。

您的应用程序固定在“ dotnet”的不支持的运行时版本中。为了更好地性能,我们建议使用我们的支持版本之一:〜3。

和相同的图像缩放。

所以我更改

FUNCTIONS_EXTENSION_VERSION      = "~4"

FUNCTIONS_EXTENSION_VERSION      = "~3"

现在解决了这一问题。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文