AADSTS90002:找不到租户"xx".如果租户没有活动订阅,则可能会发生这种情况 [英] AADSTS90002: Tenant 'xx' not found. This may happen if there are no active subscriptions for the tenant
问题描述
I followed this tutorial to generate an access token from client app for target app. According to the comment for this tutorial, for the resources
, I changed to App ID URL. But I am still not able to successfully generate bearer token for the target app.
它显示此错误消息:
AdalException: {错误":"invalid_request",错误描述":"AADSTS90002:租户 '' 未找到.如果没有活动,可能会发生这种情况 租户的订阅....}
AdalException: {"error":"invalid_request","error_description":"AADSTS90002: Tenant '' not found. This may happen if there are no active subscriptions for the tenant....}
有人知道我还想念什么吗?
Anyone knows what else I missed?
推荐答案
使用ADAL通过客户端凭据流获取访问令牌:
Using ADAL to get access token using client credential flow :
AuthenticationContext authenticationContext =
new AuthenticationContext("https://login.microsoftonline.com/<tenantId>");
ClientCredential clientCredential = new ClientCredential(clientId, appKey);
AuthenticationResult result =
await authenticationContext.AcquireTokenAsync("https://resourceUrl",
clientCredential);
参考资料: https://github .com/AzureAD/azure-activedirectory-library-for-dotnet/wiki/Client-credential-flows
和文档: 查看全文