什么是 AuthorizationLevel.User 以及如何正确使用它?

What's AuthorizationLevel.User and how to use it correctly?

我刚刚将我的函数应用配置为使用 azure 活动目录。之后,我想通过更改 HttpTrigger 属性中的枚举来停用功能级身份验证。然后我发现有可能切换到 "User" AuthorizationLevel 描述为:

Allow access to requests that include a valid authentication token

部署我的函数后,我只收到 401 个未经授权的请求,所以我切换回匿名授权级别。

public enum AuthorizationLevel
    {
        //
        // Summary:
        //     Allow access to anonymous requests.
        Anonymous = 0,
        //
        // Summary:
        //     Allow access to requests that include a valid authentication token
        User = 1,
        //
        // Summary:
        //     Allow access to requests that include a function key
        Function = 2,
        //
        // Summary:
        //     Allows access to requests that include a system key
        System = 3,
        //
        // Summary:
        //     Allow access to requests that include the master key
        Admin = 4
    }

所以我的问题是,如何正确使用"user"授权级别?我可以在启用 azure 活动目录的情况下使用它吗?

当前不支持

User。它最终将用于支持 App Service 身份验证,但现在不起作用。

截至今天,用户级别仍不受支持,其预定时间为:

v2 GA release (which also doesn't have a specific date, other than later this year).

可以在这里跟踪进度; Support EasyAuth #33.

现已支持。您可以在此处查看讨论:issue-auth