azure - 在多租户应用程序中如何检查应用程序在 Azure 门户中注册的租户数据?
问题描述
我有 2 个来自不同组织(租户)的 SharePoint 网站:
- 租户 1:abc.sharepoint.com
- 租户 2:xyz.sharepoint.com
已在 Tenan 1 'abc.sharepoint.com' 的 Azure 门户上注册并授予应用程序的必要权限,以便租户 2 用户可以访问它:'xyz.sharepoint.com'
- 身份验证工作正常
- 当我通过租户 1 'abc.sharepoint.com' 的用户进行身份验证时,对共享点列表数据的访问正常工作
我想要的是通过租户 2 'xyz.sharepoint.com' 的用户进行身份验证,您可以查阅 sharepoint 的数据,例如:
当我提出请求时:
https://graph.microsoft.com/v1.0/sites/root 或 https://graph.microsoft.com/v1.0/sites/xyz.sharepoint.com
它令人满意地返回信息,因为它咨询了“xyz.sharepoint.com”的站点,因为用户来自该租户
...但是当我咨询指定租户“abc.sharepoint.com”时
https://graph.microsoft.com/v1.0/sites/abc.sharepoint.com
返回以下错误:
{ "error": { "code": "invalidRequest", "message": "Invalid hostname for this tenancy", "innerError": { "request-id": "c0a8fa51-245b-4d1e-bf0b-5f32b6c0eb26", "date": "2019-08-17T16:27:57" } } }
一个与另一个租户的用户进行身份验证。如何查看应用程序已注册的信息?
解决方案
我们不能使用从一个租户获得的访问令牌来访问另一个租户。
如果你想这样做,你需要:
- 将租户 2 'xyz.sharepoint.com' 的用户作为访客添加到租户 1 'abc.sharepoint.com'。请参阅快速入门:将来宾用户添加到 Azure 门户中的目录。
- 使用租户 1 的管理员帐户对租户 2 的 Azure AD 中注册的应用程序进行管理员同意。只需打开浏览器并发出请求
https://login.microsoftonline.com/common/oauth2/authorize?client_id={client id of the app registered in Azure AD of Tenant 2}&response_type=code&redirect_uri={reply url of the app registered in Azure AD of Tenant 2}&nonce=1234&resource=https://graph.microsoft.com&prompt=admin_consent
推荐阅读
- python - 为什么 [[None] * N] * N] 创建的子数组都是一样的?
- ios - 在 Swift 中使用 UIBezierPath 和 CAShapeLayer 绘制具有弯曲边和直边的三角形
- java - 如何在 VSCODE 中运行两个 Java 文件?
- django - 运行多态关系迁移时 Django 外键不匹配
- kotlin - 我可以通过在其体内调用一些函数来从 lambda 返回吗(非本地返回)
- javascript - 在树视图和平面视图之间切换
- pandas - 使用分组结果创建字典
- r - 如何根据 DATE 合并 2 个数据集
- javascript - 如何在纯javascript中实现jQuery的parentsUntil方法
- regex - 如何在特定字符之前使用正则表达式匹配大于 50 的数字