성태의 닷넷 이야기
홈 주인
모아 놓은 자료
프로그래밍
질문/답변
사용자 관리
사용자
메뉴
아티클
외부 아티클
유용한 코드
온라인 기능
MathJax 입력기
최근 덧글
[정성태] Modules 창(Ctrl+Shift+U)을 띄워서, 해당 Op...
[정성태] 만드실 수 있습니다. 단지, Unity 엔진 내의 스크립트와 W...
[공진영] 안녕하세요 좋은글 감사합니다. 현재 제가 wpf로 관제 모...
[정성태] The Windows Registry Adventure #1: ...
[정성태] systemd for Developers I ; https:/...
[정성태] 엄밀히 object 타입의 인스턴스가 다른 타입으로 형변환 가능...
[정성태] 아래의 글에서 나오는 "Windows Application Pa...
[정성태] The history of calling conventions,...
[정성태] Secure and Deploy .NET Windows Form...
[정성태] Get Started with Milvus Vector DB i...
글쓰기
제목
이름
암호
전자우편
HTML
홈페이지
유형
제니퍼 .NET
닷넷
COM 개체 관련
스크립트
VC++
VS.NET IDE
Windows
Team Foundation Server
디버깅 기술
오류 유형
개발 환경 구성
웹
기타
Linux
Java
DDK
Math
Phone
Graphics
사물인터넷
부모글 보이기/감추기
내용
<div style='display: inline'> <h1 style='font-family: Malgun Gothic, Consolas; font-size: 20pt; color: #006699; text-align: center; font-weight: bold'>Azure Active Directory - The resource principal named api://...[client_id]... was not found in the tenant</h1> <p> App 등록을 아래의 글에 따라,<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > C# - Azure AD 인증을 지원하는 ASP.NET Core/5+ 웹 애플리케이션 예제 구성 ; <a target='tab' href='https://www.sysnet.pe.kr/2/0/12614'>https://www.sysnet.pe.kr/2/0/12614</a> </pre> <br /> 다음의 구성 정도로 했습니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > name: test-auth-webapp Certificates & secrets: 1개 생성 API permissions: Directry.Read.All, User.Read.All </pre> <br /> 그다음 아래와 같은 API를 호출했는데,<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > // MICROSOFT GRAPH – HOW TO IMPLEMENT IAUTHENTICATIONPROVIDER // ; <a target='tab' href='https://adrianszen.com/2019/06/16/microsoft-graph-how-to-implement-iauthenticationprovider/'>https://adrianszen.com/2019/06/16/microsoft-graph-how-to-implement-iauthenticationprovider/</a> public async Task AuthenticateRequestAsync(HttpRequestMessage request) { var clientApplication = ConfidentialClientApplicationBuilder.Create(this.clientId) .WithClientSecret(this.clientSecret) .WithTenantId(this.tenantId) .Build(); // Client credential flows - Client credential flows in MSAL.NET // <a target='tab' href='https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/Client-credential-flows'>https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/Client-credential-flows</a> var result = await clientApplication.AcquireTokenForClient(this.appScopes).ExecuteAsync(); if (request.Headers.Contains("Authorization") == false) { request.Headers.Add("Authorization", result.CreateAuthorizationHeader()); } } </pre> <br /> 이런 오류가 발생합니다.<br /> <br /> <div style='BACKGROUND-COLOR: #ccffcc; padding: 10px 10px 5px 10px; MARGIN: 0px 10px 10px 10px; FONT-FAMILY: Malgun Gothic, Consolas, Verdana; COLOR: #005555'> AADSTS500011: The resource principal named api://...[client_id]... was not found in the tenant named ...[tenant_id].... This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant.<br /> <br /> Trace ID: ...[생략]...<br /> Correlation ID: ...[생략]...<br /> Timestamp: ...[생략]...<br /> </div><br /> <br /> 분명히 Azure Active Directory에서 해당 "[client_id]"와 "[tenant_id]"로 지정된 App을 등록했는데 저렇게 오류가 발생합니다. 이거저거 하다 보니, "Application ID URI"를 생성하지 않으면 저렇게 찾지 못하는 오류가 발생하는데요, ^^; 따라서 해당 App 설정의 "Expose an API" 범주에서,<br /> <br /> <img alt='not_found_in_tenant_1.png' src='/SysWebRes/bbs/not_found_in_tenant_1.png' /><br /> <br /> 위의 화면처럼 "Application ID URI" 우측에 있는 "Set" 버튼을 눌러주면 "[client_id]"에 해당하는 api 경로가 다음과 같은 식으로 생성됩니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > api://30dabf24-4603-4dbe-bf29-e09a89c9be72 </pre> <br /> 이제 다시 AcquireTokenForClient 메서드를 호출하면 오류 없이 정상적으로 동작합니다.<br /> </p><br /> <br /><hr /><span style='color: Maroon'>[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]</span> </div>
첨부파일
스팸 방지용 인증 번호
1610
(왼쪽의 숫자를 입력해야 합니다.)