Skip to content

Conversation

@paulmedynski
Copy link
Contributor

@paulmedynski paulmedynski commented Jan 22, 2026

Description

This PR ties everything together:

  • Removes Azure authentication files from the MDS projects.
  • Adds dependencies to the Abstractions package everywhere necessary.
  • Updates pipelines to include Abstractions and Azure packages where necessary.
  • Removed some unnecessary flexibility in the MDS official pipeline.

PR series:

Testing

  • Normal PR/CI pipeline runs will validate most changes.
  • Manual inspection of pipeline logs and artifacts will confirm some of the fiddly parts.

…ogether

- Brought over all of the remaining code and project changes.
…ogether

- Brought over the pipeline changes.
- Removed unnecessary flexibility from the MDS official pipeline tree.
@paulmedynski paulmedynski added this to the 7.0.0-preview4 milestone Jan 22, 2026
@paulmedynski paulmedynski added the Area\Azure Connectivity Use this to tag issues that are related to Azure connectivity. label Jan 22, 2026
Copilot AI review requested due to automatic review settings January 22, 2026 15:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request is the third step in the Azure Split work, which removes Azure authentication implementation from the main SqlClient project and establishes dependencies on the new Abstractions package. The PR removes Azure-specific authentication code, updates project dependencies, adds test authentication providers, and updates CI/CD pipelines to handle the new package structure.

Changes:

  • Removes ActiveDirectoryAuthenticationProvider, SqlAuthenticationProvider, SqlAuthenticationToken, SqlAuthenticationParameters, and related Azure authentication classes from the MDS source
  • Adds dependency on Microsoft.Data.SqlClient.Extensions.Abstractions package across all MDS projects (src and ref)
  • Updates test infrastructure with UsernamePasswordProvider and ManagedIdentityProvider implementations for manual tests
  • Updates all pipeline YAML files to include AbstractionsPackageVersion parameter and propagate it through build and test steps

Reviewed changes

Copilot reviewed 45 out of 45 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tools/specs/Microsoft.Data.SqlClient.nuspec Adds Abstractions package dependency to all target frameworks
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.cs Implements dynamic loading of Azure extension package as default provider
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Connection/SqlConnectionInternal.cs Refactors token acquisition retry logic to use new exception model
src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/*.cs Adds test authentication providers
src/Microsoft.Data.SqlClient/**/Microsoft.Data.SqlClient.csproj Removes Azure.* package references, adds Abstractions reference
eng/pipelines/**/*.yml Adds AbstractionsPackageVersion parameter throughout

Comment on lines +267 to 277
foreach (SqlAuthenticationMethod candidateMethod in Instance._authenticationsWithAppSpecifiedProvider)
{
if (candidateMethod == authenticationMethod)
{
_sqlAuthLogger.LogError(nameof(SqlAuthenticationProviderManager), methodName, $"Failed to add provider {GetProviderType(provider)} because a user-defined provider with type {GetProviderType(_providers[authenticationMethod])} already existed for authentication {authenticationMethod}.");
return false; // return here to avoid replacing user-defined provider
Instance._sqlAuthLogger.LogError(nameof(SqlAuthenticationProviderManager), methodName, $"Failed to add provider {GetProviderType(provider)} because a user-defined provider with type {GetProviderType(Instance._providers[authenticationMethod])} already existed for authentication {authenticationMethod}.");

// The app has already specified a Provider for this
// authentication method, so we won't override it.
return false;
}
}
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

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

This foreach loop implicitly filters its target sequence - consider filtering the sequence explicitly using '.Where(...)'.

Copilot uses AI. Check for mistakes.
// Use Connection timeout value to cancel token acquire request
// after certain period of time.(int)
if (_timeout.MillisecondsRemaining < int.MaxValue)
CancellationTokenSource cts = new();
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

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

Disposable 'CancellationTokenSource' is created but not disposed.

Suggested change
CancellationTokenSource cts = new();
using CancellationTokenSource cts = new();

Copilot uses AI. Check for mistakes.
…ogether

- Removed Azure parameters from CI test tree.
…ogether

- Fixed missing Abstractions and MDS package version parameters.
Copilot AI review requested due to automatic review settings January 22, 2026 16:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 45 out of 45 changed files in this pull request and generated no new comments.

int retryPeriod =
ex.RetryPeriod > 0
? ex.RetryPeriod
: defaultRetryPeriod * (2 ^ attempt);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
: defaultRetryPeriod * (2 ^ attempt);
: defaultRetryPeriod * (1 << attempt);

var activeDirectoryAuthProvider = new ActiveDirectoryAuthenticationProvider(instance._applicationClientId);
instance.SetProvider(SqlAuthenticationMethod.ActiveDirectoryIntegrated, activeDirectoryAuthProvider);
// Try to load our Azure extension.
var assembly = Assembly.Load(assemblyName);
Copy link
Contributor

Choose a reason for hiding this comment

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

To back up your TODO, this'll need to be loaded with a strong name, otherwise a client which doesn't use Azure connectivity will load any assembly at [application base]/Microsoft.Data.SqlClient.Extensions.Azure/Microsoft.Data.SqlClient.Extensions.Azure.dll and pass this any Azure credentials.

With the assembly signature verified by including the public key token in the assembly name, maybe we could simplify the load process and directly use Type.GetType with a fully-qualified assembly name.

@codecov
Copy link

codecov bot commented Jan 23, 2026

Codecov Report

❌ Patch coverage is 52.57732% with 92 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.78%. Comparing base (e4fdb36) to head (16a3cd8).

Files with missing lines Patch % Lines
...Data/SqlClient/SqlAuthenticationProviderManager.cs 44.33% 59 Missing ⚠️
...Data/SqlClient/Connection/SqlConnectionInternal.cs 53.12% 15 Missing ⚠️
...ta/SqlClient/SqlAuthenticationParametersBuilder.cs 77.55% 11 Missing ⚠️
...SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs 0.00% 7 Missing ⚠️
Additional details and impacted files
@@                   Coverage Diff                    @@
##           dev/paul/azure/step2    #3908      +/-   ##
========================================================
- Coverage                 69.92%   69.78%   -0.15%     
========================================================
  Files                       263      260       -3     
  Lines                     66190    65694     -496     
========================================================
- Hits                      46285    45844     -441     
+ Misses                    19905    19850      -55     
Flag Coverage Δ
netcore 69.74% <49.48%> (-0.18%) ⬇️
netfx 68.98% <52.57%> (-0.20%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area\Azure Connectivity Use this to tag issues that are related to Azure connectivity.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants