diff --git a/src/lib/PnP.Framework/AuthenticationManager.cs b/src/lib/PnP.Framework/AuthenticationManager.cs index c8ee6540..ccfcd4b9 100644 --- a/src/lib/PnP.Framework/AuthenticationManager.cs +++ b/src/lib/PnP.Framework/AuthenticationManager.cs @@ -361,23 +361,23 @@ public AuthenticationManager(string endpoint, string identityHeader, ManagedIden { case ManagedIdentityType.UserAssignedByClientId: Diagnostics.Log.Debug(Constants.LOGGING_SOURCE, $"Using the user assigned managed identity with client ID: {managedIdentityUserAssignedIdentifier}"); - mi = ManagedIdentityApplicationBuilder.Create(ManagedIdentityId.WithUserAssignedClientId(managedIdentityUserAssignedIdentifier)).Build(); + mi = ManagedIdentityApplicationBuilder.Create(ManagedIdentityId.WithUserAssignedClientId(managedIdentityUserAssignedIdentifier)).WithHttpClientFactory(HttpClientFactory).Build(); break; case ManagedIdentityType.UserAssignedByObjectId: Diagnostics.Log.Debug(Constants.LOGGING_SOURCE, $"Using the user assigned managed identity with object/principal ID: {managedIdentityUserAssignedIdentifier}"); - mi = ManagedIdentityApplicationBuilder.Create(ManagedIdentityId.WithUserAssignedObjectId(managedIdentityUserAssignedIdentifier)).Build(); + mi = ManagedIdentityApplicationBuilder.Create(ManagedIdentityId.WithUserAssignedObjectId(managedIdentityUserAssignedIdentifier)).WithHttpClientFactory(HttpClientFactory).Build(); break; case ManagedIdentityType.UserAssignedByResourceId: Diagnostics.Log.Debug(Constants.LOGGING_SOURCE, $"Using the user assigned managed identity with Azure Resource ID: {managedIdentityUserAssignedIdentifier}"); - mi = ManagedIdentityApplicationBuilder.Create(ManagedIdentityId.WithUserAssignedResourceId(managedIdentityUserAssignedIdentifier)).Build(); + mi = ManagedIdentityApplicationBuilder.Create(ManagedIdentityId.WithUserAssignedResourceId(managedIdentityUserAssignedIdentifier)).WithHttpClientFactory(HttpClientFactory).Build(); break; case ManagedIdentityType.SystemAssigned: Diagnostics.Log.Debug(Constants.LOGGING_SOURCE, "Using the system assigned managed identity"); - mi = ManagedIdentityApplicationBuilder.Create(ManagedIdentityId.SystemAssigned).Build(); + mi = ManagedIdentityApplicationBuilder.Create(ManagedIdentityId.SystemAssigned).WithHttpClientFactory(HttpClientFactory).Build(); break; } @@ -412,7 +412,8 @@ public AuthenticationManager(string clientId, string username, SecureString pass if (!string.IsNullOrEmpty(redirectUrl)) { builder = builder.WithRedirectUri(redirectUrl); - } + } + builder.WithLegacyCacheCompatibility(false); this.username = username; this.password = password; publicClientApplication = builder.Build(); @@ -471,6 +472,7 @@ public AuthenticationManager(string clientId, string redirectUrl = null, string { builder = builder.WithTenantId(tenantId); } + builder.WithLegacyCacheCompatibility(false); publicClientApplication = builder.Build(); this.customWebUi = customWebUi; @@ -519,7 +521,7 @@ public AuthenticationManager(string clientId, string tenantId, Func