与Microsoft Teams集成时如何获取租户名称 [英] How to get the tenant name when integrating with Microsoft Teams

查看:216
本文介绍了与Microsoft Teams集成时如何获取租户名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个Microsoft Teams机器人,该机器人可以创建/更新对话并接收各种事件到端点(用户加入的团队,...).我在事件中看到的只是一个租户ID.对于团队来说,我会得到一个ID,有时还会得到一个很棒的名字.

I have created a Microsoft Teams bot that can create/update conversations and receives all kinds of events to an endpoint (user joined team, ...). All I see in the events is a tenant id. For teams, i get an id and sometimes a name which is great.

使用以下流程创建/更新对话:

to create/update conversations I use this flow:

  1. https://login.microsoftonline.com获取令牌/botframework.com/oauth2/v2.0/token
  2. 发布到频道:$ {serviceUrl} v3/conversations/$ {conversationId}/activities

我的问题是,我如何获得房客的名字?我找不到这样做的任何API?

My question is, how can I get the name of a tenant? I can not find any API to do so?

用例:用户向我发送了一封支持电子邮件.我无法检查数据库并找到正确的条目,因为我所知道的只是租户ID.

Use case: A user sends me a support email. I have no way to check my database and find the correct entries because all I know is the tenant id.

我已经研究了Graph API,但不确定我的机器人是否真的可以进行这些调用(我收到各种奇怪的权限错误,例如Authorization_IdentityNotFound,无法建立调用应用程序的身份.)

I have looked into the Graph API but I'm not sure if my bot is actually able to make those calls (I get all kinds of strange permissions errors such as Authorization_IdentityNotFound The identity of the calling application could not be established.).

我想自己对API进行调用.我不想使用任何Microsoft SDK/Lib/...

I want to make the calls to the API myself. I don't want to use any Microsoft SDK/Lib/...

推荐答案

看来我必须:

  1. 在Azure门户中->应用注册-> API权限添加Microsoft Graph 应用程序权限 Organization.Read.All
  2. 对于每个租户,要求Microsoft Teams管理员访问: https://login .microsoftonline.com/$ {tenantId}/adminconsent
  3. 通过 https:/为租户获取图形令牌/login.microsoftonline.com/${tenantId}/oauth2/v2.0/token (范围:graph.microsoft.com/.default)
  4. 调用图形api https://graph.microsoft.com/v1.0/organization
  1. In Azure Portal -> App registrations -> API permissions add the Microsoft Graph application permission Organization.Read.All
  2. For each tenant, ask the Microsoft Teams admin to visit: https://login.microsoftonline.com/${tenantId}/adminconsent
  3. Get a graph token for the tenant via https://login.microsoftonline.com/${tenantId}/oauth2/v2.0/token (scope: graph.microsoft.com/.default)
  4. Call the graph api https://graph.microsoft.com/v1.0/organization

这篇关于与Microsoft Teams集成时如何获取租户名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆