【问题标题】:Azure App Configuration Managed Identity failing when called from Azure Function从 Azure 函数调用时,Azure 应用程序配置托管标识失败
【发布时间】:2021-10-08 22:18:29
【问题描述】:

我正在关注Use managed identities to access app configuration。对于第 5 步,我已将我的函数 FilterFunction 分配为具有 App Configuration Data Reader 角色:

我的函数在启动时的代码如下:

        var appConfigEndpoint = Environment.GetEnvironmentVariable("Endpoint");
        var environment = Environment.GetEnvironmentVariable("Environment");
        var sentinelValue = Environment.GetEnvironmentVariable("ConfigSentinelKey");

        builder.ConfigurationBuilder.AddAzureAppConfiguration(options =>
        {
            // Load the configuration using labels
            options.Connect(new Uri(appConfigEndpoint), new ManagedIdentityCredential())
                .ConfigureRefresh(refreshoptions => refreshoptions.Register(
                    key: sentinelValue,
                    label: environment,
                    true))
                .Select(KeyFilter.Any, environment);
        });

但是,当我将函数发布到 Azure 时,我看到以下错误:

为什么会出现这个错误?

【问题讨论】:

    标签: c# .net-core azure-functions azure-managed-identity azure-app-configuration


    【解决方案1】:

    一旦分配了角色以授予对 Azure 应用配置的访问权限。传播可能需要大约 15 分钟。在此期间,将观察您提供的错误消息。

    如果首先使用身份发出请求而没有分配角色(导致 403)然后添加角色,则尤其如此。

    【讨论】:

    • 谢谢-是的,就是这样
    猜你喜欢
    • 2021-01-10
    • 1970-01-01
    • 2021-10-04
    • 2020-08-26
    • 2023-01-18
    • 1970-01-01
    • 2020-05-02
    • 1970-01-01
    • 2022-01-09
    相关资源
    最近更新 更多