diff --git a/sdk/identity/Azure.Identity/src/IMsalPublicClientInitializerOptions.cs b/sdk/identity/Azure.Identity/src/IMsalPublicClientInitializerOptions.cs
index fd0d0d4d269..ad6de07f34a 100644
--- a/sdk/identity/Azure.Identity/src/IMsalPublicClientInitializerOptions.cs
+++ b/sdk/identity/Azure.Identity/src/IMsalPublicClientInitializerOptions.cs
@@ -6,11 +6,20 @@
namespace Azure.Identity
{
+ ///
+ /// tdb.
+ ///
[Friend("Azure.Identity.Broker")]
- internal interface IMsalPublicClientInitializerOptions
+ public interface IMsalPublicClientInitializerOptions
{
- Action BeforeBuildClient { get; }
+ ///
+ /// tdb.
+ ///
+ Func BeforeBuildClient { get; }
+ ///
+ /// tdb.
+ ///
bool UseDefaultBrokerAccount { get; set; }
}
}
diff --git a/sdk/identity/Azure.Identity/src/MsalPublicClient.cs b/sdk/identity/Azure.Identity/src/MsalPublicClient.cs
index 37df7f88673..ebdce8f96eb 100644
--- a/sdk/identity/Azure.Identity/src/MsalPublicClient.cs
+++ b/sdk/identity/Azure.Identity/src/MsalPublicClient.cs
@@ -13,7 +13,7 @@ namespace Azure.Identity
{
internal class MsalPublicClient : MsalClientBase
{
- private Action _beforeBuildClient;
+ private Func _beforeBuildClient;
internal string RedirectUrl { get; }
protected MsalPublicClient()
@@ -60,7 +60,7 @@ protected virtual ValueTask CreateClientCoreAsync(bool
if (_beforeBuildClient != null)
{
- _beforeBuildClient(pubAppBuilder);
+ pubAppBuilder = _beforeBuildClient(pubAppBuilder);
}
if (DisableInstanceDiscovery)
diff --git a/sdk/identity/Azure.Identity/tests/InteractiveBrowserCredentialTests.cs b/sdk/identity/Azure.Identity/tests/InteractiveBrowserCredentialTests.cs
index b176e9cd1b1..c35ea778d2f 100644
--- a/sdk/identity/Azure.Identity/tests/InteractiveBrowserCredentialTests.cs
+++ b/sdk/identity/Azure.Identity/tests/InteractiveBrowserCredentialTests.cs
@@ -268,9 +268,9 @@ public async Task UsesTenantIdHint([Values(null, TenantIdHint)] string tenantId,
public class ExtendedInteractiveBrowserCredentialOptions : InteractiveBrowserCredentialOptions, IMsalPublicClientInitializerOptions
{
- private Action _beforeBuildClient;
+ private Func _beforeBuildClient;
- public ExtendedInteractiveBrowserCredentialOptions(Action beforeBuildClient)
+ public ExtendedInteractiveBrowserCredentialOptions(Func beforeBuildClient)
{
_beforeBuildClient = beforeBuildClient;
}
@@ -279,7 +279,7 @@ public ExtendedInteractiveBrowserCredentialOptions(Action IMsalPublicClientInitializerOptions.BeforeBuildClient { get { return _beforeBuildClient; } }
+ Func IMsalPublicClientInitializerOptions.BeforeBuildClient { get { return _beforeBuildClient; } }
}
[Test]
@@ -294,6 +294,7 @@ public async Task InvokesBeforeBuildClientOnExtendedOptions()
Assert.NotNull(builder);
beforeBuildClientInvoked = true;
cancelSource.Cancel();
+ return builder;
}
);