如何使用我在microsoft azure中的多租户应用程序在客户端的活动目录中注册应用程序?

时间:2018-01-08 05:40:18

标签: azure oauth-2.0 azure-active-directory

我已在Azure订阅中注册了多租户应用。使用此应用程序,我想为我的客户端创建一个OAuth流,以便能够授予我在其活动目录中创建应用程序的权限。

我们正在使用OpenID连接流来访问Azure AD图形API。

尽管我们的应用程序通过控制台多租户,但当客户端(xyz@outlook.com)尝试登录时,我们收到以下错误:

User account 'xyz@outlook.com' from identity provider 'live.com' does not exist in tenant 'Default Directory' and cannot access the application 'bf5ca806-xxxx-xxxx-xxx-xxxx' in that tenant. The account needs to be added as an external user in the tenant first. Sign out and sign in again with a different Azure Active Directory user account

我使用以下端点获取访问令牌:

https://login.microsoftonline.com/common/oauth2/authorize?
client_id=xxxxxxxx-xxxx-xxxxx-xxxx-xxxxx
&response_mode=form_post
&response_type=code+id_token
&redirect_uri=http://localhost:8080
&prompt=admin_consent
&nonce=1234
&resource=https://graph.windows.net

请帮我解决此错误

1 个答案:

答案 0 :(得分:2)

很遗憾,目前无法使用来宾用户登录Azure AD Graph Explorer

我很久以前就遇到了和你一样的问题,我明白这对客户来说非常重要。因此,您可以在此User Voice Page中发布您的想法,Azure团队将会看到它。我也会支持它。

但如果您不介意,还有其他解决方案:

解决方案1 ​​:尝试使用该目录的内部帐户,该帐户以.onmicrosoft.com

结尾

解决方案2 :尝试使用其他工具与访客用户(此帐户也需要是该目录的管理员)获取访问令牌,例如邮递员。然后,您可以使用Postman调用Azure AD Graph API。您可以参考this blog将Azure AD Graph API与Postman一起使用。

希望这有帮助!