0

我正在关注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 时,我看到以下错误:

错误

为什么我会收到此错误?

4

1 回答 1

1

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

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

于 2021-08-03T22:56:49.540 回答