question

palayathar avatar image
0 Votes"
palayathar asked amanpreetsingh-msft answered

Azure AD B2C Multi tenant with Dynamics 365 - Status 404 (Not Found]

I am trying to make use of Azure AD B2C to authenticate Dynamics 365 portal app using Azure AD multi-tenant custom policy following this guidance

Azure B2C is providing claims token as expected

82337-token.png

In order to add Azure AD B2C as an identity provider to the Dynamics 365 portal app, I followed this guidance.

However, when I tried to access the Dynamics portal [https://xxxxxxxx.microsoftcrmportals.com/] using an account from Azure AD tenant, it shows an error

82392-error1.png.

When I digged deeper in to the error, I found this information from Dynamcis 365 portal [[IOException: IDX20804: Unable to retrieve document from: '[PII is hidden]'.]]

Any Ideas?







  • Full Stack Trace Below:

Server Error in '/' Application.

Response status code does not indicate success: 404 (Not Found).

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found).

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[HttpRequestException: Response status code does not indicate success: 404 (Not Found).]
System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode() +119665
Microsoft.IdentityModel.Protocols.<GetDocumentAsync>d__8.MoveNext() in C:\agent2_work\56\s\src\Microsoft.IdentityModel.Protocols\Configuration\HttpDocumentRetriever.cs:89

[IOException: IDX20804: Unable to retrieve document from: '[PII is hidden]'.]
Microsoft.IdentityModel.Protocols.<GetDocumentAsync>d_8.MoveNext() in C:\agent2_work\56\s\src\Microsoft.IdentityModel.Protocols\Configuration\HttpDocumentRetriever.cs:96
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.IdentityModel.Protocols.OpenIdConnect.<GetAsync>d
3.MoveNext() in C:\agent2_work\56\s\src\Microsoft.IdentityModel.Protocols.OpenIdConnect\Configuration\OpenIdConnectConfigurationRetriever.cs:89
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.IdentityModel.Protocols.<GetConfigurationAsync>d
_24.MoveNext() +865

[InvalidOperationException: IDX20803: Unable to obtain configuration from: '[PII is hidden]'.]
Microsoft.IdentityModel.Protocols.<GetConfigurationAsync>d_24.MoveNext() in C:\agent2_work\56\s\src\Microsoft.IdentityModel.Protocols\Configuration\ConfigurationManager.cs:202
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.Owin.Security.OpenIdConnect.<ApplyResponseChallengeAsync>d
10.MoveNext() +565
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.Owin.Security.Infrastructure.<ApplyResponseCoreAsync>d
40.MoveNext() +349
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.Owin.Security.Infrastructure.<ApplyResponseAsync>d
39.MoveNext() +447
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.Owin.Security.Infrastructure.<TeardownAsync>d
34.MoveNext() +196
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.Owin.Security.Infrastructure.<Invoke>d
5.MoveNext() +929
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.Owin.Security.Infrastructure.<Invoke>d
5.MoveNext() +735
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.Owin.Security.Infrastructure.<Invoke>d
5.MoveNext() +735
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.AspNet.Identity.Owin.<Invoke>d
0.MoveNext() +448
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.Owin.Security.Infrastructure.<Invoke>d
5.MoveNext() +735
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.Owin.Security.Infrastructure.<Invoke>d
5.MoveNext() +735
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Kentor.OwinCookieSaver.<Invoke>d
2.MoveNext() +221
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.Owin.Security.Infrastructure.<Invoke>d
5.MoveNext() +735
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.AspNet.Identity.Owin.<Invoke>d
0.MoveNext() +448
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.AspNet.Identity.Owin.<Invoke>d
0.MoveNext() +448
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.AspNet.Identity.Owin.<Invoke>d
0.MoveNext() +448
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.AspNet.Identity.Owin.<Invoke>d
0.MoveNext() +448
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.AspNet.Identity.Owin.<Invoke>d
0.MoveNext() +448
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Adxstudio.Xrm.AspNet.Cms.<Invoke>d
3.MoveNext() in S:\Framework\Adxstudio.Xrm\AspNet\Cms\StrictTransportSecurityMiddleware.cs:49
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Site.Middleware.<Invoke>d
6.MoveNext() in S:\Samples\MasterPortal\Middleware\WebsiteHeaderSettingsMiddleware.cs:95
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.AspNet.Identity.Owin.<Invoke>d
0.MoveNext() +448
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.AspNet.Identity.Owin.<Invoke>d
0.MoveNext() +448
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.AspNet.Identity.Owin.<Invoke>d
0.MoveNext() +448
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.AspNet.Identity.Owin.<Invoke>d
0.MoveNext() +448
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.AspNet.Identity.Owin.<Invoke>d
0.MoveNext() +448
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.AspNet.Identity.Owin.<Invoke>d
0.MoveNext() +448
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.AspNet.Identity.Owin.<Invoke>d
0.MoveNext() +448
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.AspNet.Identity.Owin.<Invoke>d
0.MoveNext() +448
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Adxstudio.Xrm.AspNet.Cms.<Invoke>d
2.MoveNext() in S:\Framework\Adxstudio.Xrm\AspNet\Cms\ScaleOutMiddleware.cs:111
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Adxstudio.Xrm.AspNet.Cms.<Invoke>d
3.MoveNext() in S:\Framework\Adxstudio.Xrm\AspNet\Cms\HealthMiddleware.cs:57
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Adxstudio.Xrm.AspNet.Cms.<Invoke>d
6.MoveNext() in S:\Framework\Adxstudio.Xrm\AspNet\Cms\AppInfoMiddleware.cs:69
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Adxstudio.Xrm.AspNet.Cms.<Invoke>d
5.MoveNext() in S:\Framework\Adxstudio.Xrm\AspNet\Cms\RequireSslMiddleware.cs:78
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Adxstudio.Xrm.AspNet.Cms.<Invoke>d
4.MoveNext() in S:\Framework\Adxstudio.Xrm\AspNet\Cms\ETWMiddleware.cs:57
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.<RunApp>d
7.MoveNext() +197
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.<DoFinalWork>d
_12.MoveNext() +192
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar) +118
System.Web.AsyncEventExecutionStep.InvokeEndHandler(IAsyncResult ar) +221
System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) +115







azure-ad-b2c
token.png (40.7 KiB)
error1.png (125.5 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

amanpreetsingh-msft avatar image
0 Votes"
amanpreetsingh-msft answered

Hi @palayathar · Thank you for reaching out.

As per the document, you are referring to, Issuer claim needs to be configured as mentioned below:

84851-image.png

In order to get the value of Issuer claim in https://<mytenantname>.b2clogin.com/tfp/<TENANTID>/b2c_1_signin/v2.0/ format, you need to add below metadata key to the <TechnicalProfile Id="JwtIssuer">, which is by default in the trustframeworkbase file.

<Item Key="IssuanceClaimPattern">AuthorityWithTfp</Item>

83105-image.png

Below is how the Issuer claim in the token looks like afterwards:

83116-image.png

When this key is not added default value taken is AuthorityAndTenantGuid which is why tfp and policy names are not included in the issuer claim.


Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


image.png (53.2 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.