简体   繁体   English

对 Azure Active Directory 的身份验证并收到 AADSTS90019 错误

[英]Authentication to Azure Active Directory and receive AADSTS90019 error

I am trying to authenticate against AAD using the following code:我正在尝试使用以下代码对 AAD 进行身份验证:

 string userName = "something.com"; //(just an example)
 string password = "IafksdfkasdaFadad=asdad=a="; //(just an example)
 string clientId = "6cd6590f-4db9-4c6b-98d1-476f9e90912f"; //(just an example)
 var credentials = new UserPasswordCredential(userName, password);
 var authenticationContext = new AuthenticationContext("https://login.windows.net/common");
 var result = await authenticationContext.AcquireTokenAsync("https://api.partnercenter.microsoft.com", clientId, credentials);
 return result;

and I got AADSTS90019 error: No tenant-identifying information found in either the request or implied by any provided credentials.我收到 AADSTS90019 错误:在请求中或任何提供的凭据中都找不到租户识别信息。

As a remark, it is just a console application made in Visual Studio using C#.作为备注,它只是在 Visual Studio 中使用 C# 制作的控制台应用程序。

Based on the information from https://docs.microsoft.com/en-us/azure/active-directory/develop/reference-aadsts-error-codes the explication for AADSTS90019 error is: MissingTenantRealm - Azure AD was unable to determine the tenant identifier from the request .根据来自https://docs.microsoft.com/en-us/azure/active-directory/develop/reference-aadsts-error-codes的信息,AADSTS90019 错误的解释是: MissingTenantRealm - Azure 无法确定 AD请求中的租户标识符

So, my question is: What is the tentant identifier and how should I use it in my request?所以,我的问题是:什么是 tentant 标识符,我应该如何在我的请求中使用它? Should it be the one from the following screenshot?它应该是以下屏幕截图中的那个吗? The screenshot is made from the Azure account.截图来自 Azure 账户。

Azure Application Overview Azure 应用概述

Any information can help.任何信息都可以提供帮助。

Thank you.谢谢你。

You should initialize your authentication context with a tenant-specific authority instead of common:您应该使用特定于租户的权限而不是通用权限来初始化您的身份验证上下文:

var authenticationContext = new AuthenticationContext("https://login.microsoftonline.com/your-directory-id");

Replace your-directory-id with your Directory (tenant) id.your-directory-id替换为您的目录(租户)ID。

var authenticationContext = new AuthenticationContext("https://login.windows.net/common");

Here Replace the string "common" with the tenant name.此处将字符串“common”替换为租户名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure AD的Active Directory身份验证例外(AADSTS90027) - Active Directory Authentication Exception (AADSTS90027) with Azure AD Xamarin Forms OAuth 2.0 和 Azure Active Directory - 错误 AdalServiceException:AADSTS7000218 - Xamarin Forms OAuth 2.0 and Azure Active Directory - error AdalServiceException: AADSTS7000218 在测试环境中通过 Azure Active Directory 执行身份验证过程时出错 - Error when performing the authentication process by Azure Active Directory in test environment 使用 Azure Active Directory 的 Azure Function 身份验证 - Azure Function authentication using Azure Active Directory ASP.NET中的Azure Active Directory身份验证 - Azure active directory authentication in asp.net 如何挑战Windows Azure Active Directory身份验证? - How to challenge Windows Azure Active Directory authentication? Azure Active Directory和Avocado API身份验证 - Azure Active Directory and avocado api authentication 使用 Angular 8 和 Azure Active Directory 进行身份验证 - Authentication using Angular 8 with Azure Active Directory Azure Active Directory访问错误 - Azure Active Directory access error Azure Active Directory身份验证出现错误“我们无法立即连接到您需要的服务” - Azure Active directory authentication got error “we can't connect to the service you need right now”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM