不接收有关用户个人资料更新的通知 [英] Do not receive notifications about user profile updates

查看:20
本文介绍了不接收有关用户个人资料更新的通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 Azure B2C 中获取有关用户配置文件更新的通知,并使用 Azure Functions HttpTrigger 进行处理.

I need to get notifications about user profiles updates in Azure B2C and handle them using Azure Functions HttpTrigger.

我遵循了这两个指南:

  1. https://docs.microsoft.com/en-us/graph/tutorials/change-notifications

https://github.com/microsoftgraph/webjobs-webhooks-sample

他们的结果都是成功订阅用户更新并成功处理了带有验证码的初始请求,但是当我在我的应用中编辑用户个人资料时,我没有收到任何有关更新的通知.

Result of both of them is successful subscription to user updates and successfully processed initial request with verification code, but when I am editing user profile in my app I don't get any notifications about updates.

订阅注册:

var subscription = new Subscription
            {
                ChangeType = "updated,deleted",
                NotificationUrl = "https://<ngrok_url>/persons",
                Resource = "Users",
                ExpirationDateTime = DateTime.UtcNow.AddMinutes(30),
                ClientState = "SecretClientState"
            };

更改的函数处理程序:

[FunctionName(nameof(GetChangesAsync))]
        public async Task<IActionResult> GetChangesAsync(
            [HttpTrigger(AuthorizationLevel.Function, "POST", Route = "persons")]
            HttpRequest request,
            ILogger logger)
        {
            if (request.Query.ContainsKey("validationToken"))
            {
                string validationToken = request.Query["validationToken"];

                return new OkObjectResult(validationToken);
            }

            using (var reader = new StreamReader(request.Body))
            {
                var content = await reader.ReadToEndAsync();

                var notifications = JsonConvert.DeserializeObject<Notifications>(content);

                if (notifications != null)
                {
                    foreach (var notification in notifications.Items)
                    {
                        logger.LogInformation(
                            $"Received notification: '{notification.Resource}', {notification.ResourceData?.Id}");
                    }
                }
            }

            return new OkResult();
        }

我希望每次在 Azure B2C 中编辑用户配置文件时都会收到通知 ->用户.

I expected to get notification every time when I'm editing user profile in Azure B2C -> Users.

正如上面 GitHub 页面中提到的,我可以附上我的订阅 ID:

Also as mentioned in GitHub page above I can attach my subscription id:

5ea124b2-6a48-4c09-baf0-0ed5f1c98ff0

5ea124b2-6a48-4c09-baf0-0ed5f1c98ff0

及其创建时间:

03.08.2019 11:16:03 +00:00

03.08.2019 11:16:03 +00:00

推荐答案

恐怕目前不支持使用 Microsoft Graph API 管理 Azure AD B2C.请参阅此博客的底部:Microsoft Graph 或 Azure AD Graph.

I'm afraid that Managing Azure AD B2C using Microsoft Graph API is not supported currently. See the bottom of this blog: Microsoft Graph or Azure AD Graph.

当我们配置这个示例时:https://github.com/microsoftgraph/webjobs-webhooks-sample 在 Visual Studio 中,我们需要在 App.config 文件中设置 Client ID 和 Secret.但是在 Azure B2C 应用中,我们找不到设置 Microsoft Graph 权限的地方.您可以从 Azure 门户 -> Azure AD B2C -> 应用程序 -> 选择您的应用程序 -> 查看详细信息API 访问.

When we configure this sample: https://github.com/microsoftgraph/webjobs-webhooks-sample in Visual Studio, we need to set the Client ID and Secret in App.config file. But in Azure B2C app, we cannot find a place to set Microsoft Graph permission. You can see details from Azure Portal -> Azure AD B2C -> Applications -> Select your application -> API access.

这就是为什么在 Azure B2C -> 用户中编辑用户配置文件时无法收到通知的原因.

So that's why you can't get notification while editing user profile in Azure B2C -> Users.

这篇关于不接收有关用户个人资料更新的通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆