由于 Windows 平台 FIPS 问题,Azure Functions v1 计时器触发功能无法启动

标签 azure azure-functions

我正在尝试开发一个使用计时器触发器的函数应用程序,但我遇到了 Windows 平台 FIPS 的问题,该问题阻止计时器触发的函数在本地启动。这是导致错误的代码(它是默认的计时器触发函数):

using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;

namespace FunctionApp1
{
public static class Function1
{
    [FunctionName("Function1")]
    public static void Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer, TraceWriter log)
    {
        log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
    }
}
}

当我尝试在 func.exe 中运行此函数时,会产生以下错误:

The listener for function 'Function1' was unable to start. mscorlib: Exception has been thrown by the target of an invocation. mscorlib: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.

这段代码适用于我有权访问的另一个开发环境。我需要做什么来修复这些 Windows 平台 FIPS 问题以便计时器触发器能够运行?

谢谢!

最佳答案

如果您的环境确实需要此 FipsAlgorithmPolicy,请仅为 Azure 功能禁用它。

  1. 在文件资源管理器中,打开 %localappdata%\AzureFunctionsTools\Releases\1.4.0\cli\func.exe.Config ,添加<enforceFIPSPolicy enabled="false"/><runtime>元素。请注意,这样,一旦新功能cli发布,您就必须重复此步骤。

  2. 同样,如果您在本地使用存储模拟器,请打开 C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe.config ,添加<enforceFIPSPolicy enabled="false"/>在元素下。

否则只需为您的计算机禁用 FipsAlgorithmPolicy。

  1. 在搜索框中或右键单击“开始”按钮,然后单击“运行”,输入 regedit打开注册表编辑器。

  2. 在地址栏(查看>地址栏)中,导航至 Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\FipsAlgorithmPolicy .

  3. 双击Enabled ,将数值数据更改为0。

关于由于 Windows 平台 FIPS 问题,Azure Functions v1 计时器触发功能无法启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52708184/

相关文章:

azure - 如何在 Azure 角色中以编程方式获取订阅 ID?

Azure Functions - 并行/并发函数执行和横向扩展

azure - 如何为每个工作角色_实例_(而不是角色)进行配置

.net - Azure Functions 语言和运行时版本选择,以最大限度地减少冷启动时间

azure - 如何优化区域部署以最小化感知延迟并最大程度地节省成本?

c# - 是否可以创建一个可从 EventHub 中的多个事件触发的编排持久函数?

Azure数据工厂: How to rename blob csv or text file in blob storage during copy or import?

asp.net - Azure signalR + Azure http 触发器 - 部署时授权错误

.net - az webapp 在指定 .net core 时创建错误

azure - 如何在 Azure AD B2C 租户中获取具有相关 ID 的错误日志?