Azure AD B2C won't resolve config in C# .net project after k8s upgrade

Joe White 0 Reputation points
2023-11-20T19:39:18.8333333+00:00

In a local development environment we upgraded the version of k8s that we are using to 1.28.2. After the upgrade, with no code changes, our service that manages auth is throwing the exception below. This is occurring in multiple dev environments and the code functions as expected on the prior version.

What would cause the service to not be able to resolve that configuration? If I paste the URL into a browser it works as expected and shows the openid configuration.

The configuration for AD is unchanged:

"AzureAdB2C": {
    "Instance": "https://mydirectory.b2clogin.com",
    "ClientId": "XXXXXXXXX",
    "Domain": "mydomain.onmicrosoft.com",
    "TenantId": "XXXXXXX"
  },
Exception caught in global error handler, exception message: IDX20803: Unable to obtain configuration from: 'https://mydirectory.b2clogin.com/mydirectory.onmicrosoft.com/B2C_1A_MYPOLICY/v2.0/.well-known/openid-configuration'., exception stack:    at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)
         at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()
         at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()
         at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.AuthenticateAsync()
....
System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'https://mydirectory.b2clogin.com/mydirectory.onmicrosoft.com/B2C_1A_MYPOLICY/v2.0/.well-known/openid-configuration'.
 ---> System.IO.IOException: IDX20804: Unable to retrieve document from: 'https://mydirectory.b2clogin.com/mydirectory.onmicrosoft.com/B2C_1A_MYPOLICY/v2.0/.well-known/openid-configuration'.
 ---> System.Net.Http.HttpRequestException: Resource temporarily unavailable
 ---> System.Net.Sockets.SocketException (11): Resource temporarily unavailable
   at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
.NET
.NET
Microsoft Technologies based on the .NET software framework.
2,284 questions
Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
5,141 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,428 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
17,456 questions
{count} votes