Angular 2+ 中的 Azure Graph / Microsoft Graph 查询
Azure Graph / Microsoft Graph queries in Angular 2+
我想在我的 Angular 5 Web 应用程序中查询来自 Azure Active Directory 的应用程序角色和组声明。我想授予管理员特殊权限/访问页面。我在 Azure 中注册了一个 B2C 应用程序,在 https://apps.dev.microsoft.com 注册了一个 Microsoft 应用程序,并尝试使用 MSAL.js 通过 Microsoft Graph 查询数据。
我使用来自我的 B2C Web 应用程序的应用程序 ID 作为 clientID,获取了一个令牌,并调用了端点“https://graph.microsoft.com/v1.0/users”。 数据returns作为一个数组,其中包含一个用户和我的信息。当我查询组时,我得到一个空数组。我的应用现在有多个测试用户和几个组。
我似乎正在提取与我在 Azure 中的应用程序无关的数据。我在查询正确的数据源吗?我需要设置其他权限或范围吗?
我找到了一个 ,其中包含有关群组声明的有用信息。我已经尝试将它应用于我的 Angular 应用程序,但 .NET 库似乎比 Angular 的更充实。
更多信息:
这没有帮助,但我尝试注册了一个 Active Directory 应用程序,创建了两个 API(Microsoft Graph 和 Windows Azure Active Directory)并为两者设置了所需的权限。我尝试在 MSAL.js 中使用该应用程序的应用程序 ID 和 Azure Graph Api 端点“https://graph.windows.net" which was unsuccessful. I have played around with using the Graph Explorer 但我最多只能查询一个用户。
我re-readthis article about the Azure AD Graph API noticed that in order to query the Graphs, you need to use a user id that is local to your tenant’s domain and is an admin. When I created and used my tenant’s admin (from that domain), all of the queries worked. Also I needed the Directory.Read scope. I wrote in more detail about this and a few other road blocks I came upon .
我想在我的 Angular 5 Web 应用程序中查询来自 Azure Active Directory 的应用程序角色和组声明。我想授予管理员特殊权限/访问页面。我在 Azure 中注册了一个 B2C 应用程序,在 https://apps.dev.microsoft.com 注册了一个 Microsoft 应用程序,并尝试使用 MSAL.js 通过 Microsoft Graph 查询数据。
我使用来自我的 B2C Web 应用程序的应用程序 ID 作为 clientID,获取了一个令牌,并调用了端点“https://graph.microsoft.com/v1.0/users”。 数据returns作为一个数组,其中包含一个用户和我的信息。当我查询组时,我得到一个空数组。我的应用现在有多个测试用户和几个组。
我似乎正在提取与我在 Azure 中的应用程序无关的数据。我在查询正确的数据源吗?我需要设置其他权限或范围吗?
我找到了一个
更多信息: 这没有帮助,但我尝试注册了一个 Active Directory 应用程序,创建了两个 API(Microsoft Graph 和 Windows Azure Active Directory)并为两者设置了所需的权限。我尝试在 MSAL.js 中使用该应用程序的应用程序 ID 和 Azure Graph Api 端点“https://graph.windows.net" which was unsuccessful. I have played around with using the Graph Explorer 但我最多只能查询一个用户。
我re-readthis article about the Azure AD Graph API noticed that in order to query the Graphs, you need to use a user id that is local to your tenant’s domain and is an admin. When I created and used my tenant’s admin (from that domain), all of the queries worked. Also I needed the Directory.Read scope. I wrote in more detail about this and a few other road blocks I came upon