首页 > 解决方案 > 使用 Microsoft.Graph 的 Azure Active Directory 中广告用户的扩展属性

问题描述

您好我正在尝试使用 Microsoft.Graph 包向 azure 广告用户添加扩展属性。

   var schema = new SchemaExtension()
                    {
                        Id = "Location",
                        TargetTypes = new List<string> { "User" },
                        Description = "DescribesLocation",
                        Properties = new List<ExtensionSchemaProperty>() { new ExtensionSchemaProperty { Name = "LocationCode", Type = "String" } }
                    };

                    var result = graphClient.SchemaExtensions.Request().AddAsync(schema).Result;

我在 azure ad 注册应用程序中创建了一个守护程序应用程序,并为该应用程序提供了以下权限

  1. 目录.阅读.全部
  2. Directory.ReadWrite.All
  3. User.Invite.All
  4. 用户读
  5. 用户阅读全部
  6. User.ReadWrite.All
  7. 组读全部
  8. Group.ReadWrite.All

我收到错误消息,代码:Authorization_RequestDenied 消息:权限不足,无法完成操作。此操作还需要哪些其他权限,哪些不需要?

标签: azuremicrosoft-graph-apimicrosoft-graph-sdks

解决方案


您需要Directory.AccessAsUser.All权限。以下是一些您可能会发现有用的测试用例。


推荐阅读