具有 Azure AD 身份验证的 Azure 函数 - 允许的 token 受众不适用于 Microsoft Graph

标签 azure azure-active-directory azure-functions

我已使用 Azure AD 身份验证配置了 Azure Function,请遵循此文档 - Enable Azure Active Directory in your App Service app .

配置完成后,会添加功能app url,例如:自动将 https://appname.azurewebsites.net 添加到 Allowed Token Audiences ,如下所示,然后我们可以轻松使用 client credential flow获取 token 来调用例如我的函数应用程序中的 http 触发器。

enter image description here

如果我将 Azure AD Graph 资源 URL https://graph.windows.net 添加到允许的 token 受众,我还可以使用此流程来获取调用我的函数的 token 。

enter image description here

enter image description here

但是,如果我添加 Microsoft Graph 资源 URL https://graph.microsoft.com 并获取调用该函数的 token ,我将收到错误。

You do not have permission to view this directory or page.

enter image description here

enter image description here

如何解决这个问题?这是允许的 token 受众的正确用法吗?如果没有,为什么 https://graph.windows.net 工作正常?

任何想法都会受到赞赏。

最佳答案

如果已添加 Microsoft graph,您能否在 api 权限下检查您在 azure AD 中的应用注册情况?如果没有,请将其添加为委托(delegate)权限并尝试一下。

关于具有 Azure AD 身份验证的 Azure 函数 - 允许的 token 受众不适用于 Microsoft Graph,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63501581/

相关文章:

azure - 通过 HTTP 端点触发时,带有 enqueueTimeUtc 参数的 ServiceBusTrigger 失败

Azure 媒体播放器无法在 MS Azure 媒体服务上播放上传的视频

c# - 使用 Microsoft.Identity 与 Azure.Identity 对 Microsoft Graph 的守护进程调用

java - Spring Boot Azure 部署无法更新代码

azure-active-directory - 撤销 Azure AD B2c 用户的登录 session 不适用于 native 应用程序

azure - Function App 在本地运行良好,但部署到 Azure 时失败

azure - 使用 Microsoft Azure 认知服务 API 收到 401/404 错误

azure - 如何在 on_behalf_of 流程中创建 client_assertion 和断言

c# - 如何解决使用Microsoft帐户登录时出现AADSTS700016错误?

python - 如何使用 Azure 函数和 python 写入 blob 容器中的文本文件?