Skip to content

Perform Azure Authentication Split - #3392

Closed
paulmedynski wants to merge 3 commits into
mainfrom
dev/paul/azure-split
Closed

paulmedynski wants to merge 3 commits into
mainfrom
dev/paul/azure-split

Conversation

@paulmedynski

Copy link
Copy Markdown
Contributor
  • Setup new Extensions and Azure extension projects.
  • Moved shared types over into Extensions.
  • Moved Azure auth types into Azure.
  • Updated netcore and netfx projects to reference Extensions.
  • Updated netcore and netfx projects to build on Linux.

@paulmedynski paulmedynski added this to the 7.0-preview1 milestone Jun 4, 2025
@paulmedynski paulmedynski added Public API 🆕 Issues/PRs that introduce new APIs to the driver. Breaking Change 🔨 Issues/PRs that are related with breaking API changes in the driver. labels Jun 4, 2025
@paulmedynski paulmedynski changed the title User Story 37652: Perform Azure Authentication Split Perform Azure Authentication Split Jun 4, 2025
@ErikEJ

ErikEJ commented Jun 4, 2025

Copy link
Copy Markdown
Contributor

Maybe refer to related and most voted issue?

How will this be delivered (which NuGet packages) ?

@edwardneal

Copy link
Copy Markdown
Contributor

I realise this is still in draft, but PR #2884 had a couple of interesting conversations about configuring the Azure authentication provider to use WAM without dragging in the System.Windows.Forms dependencies - in particular, around the SetIWin32WindowFunc and the SetParentActivityOrWindow methods. It also introduced the use of SynchronisationContext, to help prevent deadlocks in the UI thread. The current PR's introducing a breaking change, so perhaps this reorganisation is the right opportunity to resuscitate that PR and cut the hard dependency on System.Windows.Forms.

@paulmedynski

Copy link
Copy Markdown
Contributor Author

This is an exploratory draft PR meant for internal consumption for the time being. It's the easiest way to get some pretty diffs that we can use to discuss the path forward. I'll watch here for external commentary though, and we will take everything under consideration.

- Setup new Extensions and Azure extension projects.
- Moved shared types over into Extensions.
- Moved Azure auth types into Azure.
- Updated netcore and netfx projects to reference Extensions.
- Updated netcore and netfx projects to build on Linux.
- Created SqlAuthenticationProviderException class to encapsulate MSAL errors.
- Updated MDS to search for the Azure extension and use it as a default auth provider.
- Cleaned up ref projects.
- Cleaned up MDS XML docs to exclude members/fields declared in Extensions.
- Removed MDS dependency on Azure.Identity.
- Added missing dependencies to netfx project.
- Added retry checks to Azure provider.
- Left TODOs related to some retry policies and exception handling.
@paulmedynski
paulmedynski force-pushed the dev/paul/azure-split branch from fe232fe to 1b59ec0 Compare June 6, 2025 14:21

@paulmedynski paulmedynski left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marking where I have reviewed to.

@mdaigle

mdaigle commented Jun 6, 2025

Copy link
Copy Markdown
Contributor

I realise this is still in draft, but PR #2884 had a couple of interesting conversations about configuring the Azure authentication provider to use WAM without dragging in the System.Windows.Forms dependencies - in particular, around the SetIWin32WindowFunc and the SetParentActivityOrWindow methods. It also introduced the use of SynchronisationContext, to help prevent deadlocks in the UI thread. The current PR's introducing a breaking change, so perhaps this reorganisation is the right opportunity to resuscitate that PR and cut the hard dependency on System.Windows.Forms.

@edwardneal that's my intention :) I've been waiting for this work to kick off to pick up the WAM work again.

namespace Microsoft.Data.SqlClient;

/// <include file='../doc/ISqlAuthenticationParameters.xml' path='docs/members[@name="ISqlAuthenticationParameters"]/ISqlAuthenticationParameters/*'/>
public interface ISqlAuthenticationParameters

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paulmedynski You may want to reconsider the usage of an interface for a public API.
Interfaces cannot be evolved with new members.
If a new method/property is added to interface, then older implementations become incompatible. With base class and virtual methods, the evolution of public API is possible.

I thought I will leave this thought here, even though I know this PR is WIP.

- Changed ISqlAuthenticationParameters from an interface to a base class.
- Added NuGet package creation config.
- Now referencing Extensions via <PackageReference>, with local NuGet source.
@Frulfump

Copy link
Copy Markdown

PR Closed without comment is that bad news for the split?

@paulmedynski

Copy link
Copy Markdown
Contributor Author

This was a draft PR for internal consumption. I am splitting the work up in to smaller chunks. You will see more PRs as this work becomes ready.

@christothes

Copy link
Copy Markdown
Contributor

@paulmedynski
This might be a good opportunity to decouple Azure.Identity from your auth story. We initially explored such options with the AccessTokenCallback. I realize one of the challenges is how to allow something like the DefaultAzureCredential functionality via connection string alone, but perhaps there are other approaches we could consider.

@David-Engel David-Engel removed this from the 7.0-preview1 milestone Sep 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking Change 🔨 Issues/PRs that are related with breaking API changes in the driver. Public API 🆕 Issues/PRs that introduce new APIs to the driver.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants