首页 文章

Angular 2中的Azure Graph / Microsoft Graph查询

提问于
浏览
1

我想在Angular 5 Web App中查询Azure Active Directory中的应用程序角色和组声明 . 我想给管理员特殊的权限/访问页面 . 我在Azure注册了一个B2C应用程序,在https://apps.dev.microsoft.com注册了一个Microsoft应用程序,并尝试通过Microsoft Graph使用MSAL.js查询数据 .

我使用来自我的B2C Web App的应用程序ID作为clientID,获取了一个令牌,并调用了 endpoints “https://graph.microsoft.com/v1.0/users” . The data returns as an array with one user with my information. When I query the groups I get an empty array. My app right now has multiple test users, and a few groups.

It seems I am pulling data unrelated to my app in Azure. Am I querying the right source of data? Do I need to set other permissions or scopes?

我发现post有关于群组声明的有用信息 . 我've tried applying it to my Angular App, but the .NET libraries seem more fleshed out than Angular' .

更多信息:它是MSAL.js中的应用程序ID,Azure Graph Api endpoints “https://graph.windows.net”未成功 . 我已经玩过使用Graph Explorer,但我能够查询的最多的是一个用户 .

1 回答

  • 0

    我重新阅读了有关Azure AD Graph API的this article,注意到为了查询图表,您需要使用租户域的本地用户ID并且是管理员 . 当我创建并使用我的租户的管理员(来自该域)时,所有查询都有效 . 我还需要Directory.Read范围 . 我更详细地写了这个以及我遇到的其他几个路障here .

相关问题