dotnet / dotnet/SqlClient

Provide an option for embedded or system browser with Azure interactive authentication

Open
#2,611 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
989
Forks
340
Avg merge
4d 18h
Merged PRs (30d)
69

Description

Azure interactive logins call the MSAL function `AcquireTokenInteractive`. The source code [comments](https://github.com/dotnet/SqlClient/blob/eb46c58805e562a59c1f8d9fb2338645e1a39b05/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ActiveDirectoryAuthenticationProvider.cs#L373) clearly explain the differences in default behaviour between browsers and .NET versions vis whether an embedded browser or the system browser is used for login. But in all cases, `SqlClient` does use the default behaviour of MSAL.

It would be better if the consumer application could choose whether an integrated or system browser is used, and this is supported by MSAL via [WithUseEmbeddedWebView](https://learn.microsoft.com/en-ca/entra/msal/dotnet/acquiring-tokens/desktop-mobile/acquiring-tokens-interactively#withuseembeddedwebview). What is missing is an option for the consumer to choose the behaviour here.

There is currently no alternative apart from to accept the default, or fork `SqlClient` and make the change ourselves.

At a higher level, this same feature was added to [Azure.Identity](https://github.com/Azure/azure-sdk-for-net/issues/34576) based on our feature request so I believe that shows the worth in the idea. It's not an option here since `SqlClient` uses MSAL directly without an intermediate library (as far as I can tell).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.