如何从 Azure Ad 图表中获取联系人 api

How to get contacts from Azure Ad graph api

我正在尝试使用 Azure AD Graph API 获取联系人列表,但不知道如何授予应用程序读取联系人的权限。 Azure AD Graph API 仅为这些对象提供操作

"申请, 设备, 目录, 领域, 成员, 政策

请告诉我如何授予应用程序读取联系人的权限。

据我所知,microsoft graph api已经取代了azure ad graph(现在微软推荐microsoft graph over azure ad graph)。所以你可以使用微软图 api(List contacts).

您只需要在 azure ad 中转到您的应用并单击 "API permissions" 按钮,然后按照以下步骤操作:

然后将tutorial中提到的权限添加到您的应用程序中。

之后,我们还需要点击按钮"Grant admin consent for * "。

现在您可以从您的应用请求访问令牌并使用该令牌请求图形 api。

更新:

如果你想请求 azure ad graph api,你只需要添加 Directory.Read.All 权限。如果使用"password"作为grant_type,请在"Delegated permissions"下添加Directory.Read.All。如果使用"client_credentials"作为grant_type,请在"Application permissions"下添加Directory.Read.All

之后,您可以请求 azure ad graph api 成功获取联系人。