Conversation
…ork together to provide EntraID authentication functionality.
There was a problem hiding this comment.
Pull request overview
This PR adds a new sample console application for testing Azure authentication with Microsoft.Data.SqlClient. The app is designed as a smoke test to verify package compatibility and Azure AD authentication functionality, with support for testing against both published NuGet packages and locally-built packages from the packages/ directory.
Changes:
- Adds
AzureAuthenticationsample app indoc/apps/AzureAuthentication/with flexible package version configuration - Includes comprehensive documentation with usage examples and build instructions
- Updates
doc/Directory.Packages.propsto reference the latest stable SqlClient version (6.1.4)
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/Microsoft.Data.SqlClient.sln |
Adds the new AzureAuthentication project to the solution |
doc/apps/AzureAuthentication/AzureAuthentication.csproj |
Project file targeting net481 and net10.0 with conditional Azure package references |
doc/apps/AzureAuthentication/Program.cs |
Main application implementing command-line interface with connection testing and event logging |
doc/apps/AzureAuthentication/README.md |
Comprehensive documentation covering purpose, usage, examples, and prerequisites |
doc/apps/AzureAuthentication/Directory.Build.props |
Enables Central Package Management for the sample app |
doc/apps/AzureAuthentication/Directory.Packages.props |
Defines default package versions with overridable MSBuild properties |
doc/apps/AzureAuthentication/NuGet.config |
Configures local packages/ directory as a package source |
doc/apps/AzureAuthentication/GeneratePackageVersions.targets |
MSBuild task to generate code exposing package versions at runtime |
doc/apps/AzureAuthentication/packages/.gitkeep |
Ensures git tracks the empty packages directory |
doc/Directory.Packages.props |
Updates SqlClient reference to latest stable version 6.1.4 |
| "Supply specific package versions when building to test different versions of the " + | ||
| "SqlClient suite, for example:" + Environment.NewLine + | ||
| Environment.NewLine + | ||
| " -p:SqlClientVersion=7.0.0.preview4" + Environment.NewLine + |
There was a problem hiding this comment.
The version format in the example is incorrect. The example shows 7.0.0.preview4 but valid NuGet version formats use a hyphen, not a period, before the pre-release label (e.g., 7.0.0-preview4).
| " -p:SqlClientVersion=7.0.0.preview4" + Environment.NewLine + | |
| " -p:SqlClientVersion=7.0.0-preview4" + Environment.NewLine + |
| @@ -0,0 +1,2 @@ | |||
| # This presence of this file ensures that git creates the packages/ directory, which must exist | |||
There was a problem hiding this comment.
Grammatical error: "This presence of this file" should be "The presence of this file".
| # This presence of this file ensures that git creates the packages/ directory, which must exist | |
| # The presence of this file ensures that git creates the packages/ directory, which must exist |
|
|
||
| Supply specific package versions when building to test different versions of the SqlClient suite, for example: | ||
|
|
||
| -p:SqlClientVersion=7.0.0.preview4 |
There was a problem hiding this comment.
The version format in the example is incorrect. The example shows 7.0.0.preview4 but valid NuGet version formats use a hyphen, not a period, before the pre-release label (e.g., 7.0.0-preview4). The same issue appears on lines 72 and 145.
| -p:SqlClientVersion=7.0.0.preview4 | |
| -p:SqlClientVersion=7.0.0-preview4 |
| <PackageReference Include="System.CommandLine" /> | ||
| </ItemGroup> | ||
|
|
||
| <!-- Generate code with the SqlClient package versions. --> |
There was a problem hiding this comment.
Is there any reason not to make the package version strings that are already embedded in our assemblies available as a public API? It would be nice to just access them as:
Microsoft.Data.SqlClient.VersionInfo.PackageVersion
Microsoft.Data.SqlClient.Extensions.Logging.VersionInfo.PackageVersion
...
Thoughts? We would have to make sure each package contains an assembly with a sensible namespace. Avoiding type ambiguity due to using declarations would be an issue though.
| @@ -0,0 +1,111 @@ | |||
| <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
There was a problem hiding this comment.
This is a bunch of Copilot foo that appears to work. I'm not sure if it actually regenerates on every build though.
@paulmedynski Can this be simplified and guaranteed to always generate the C# file?
There was a problem hiding this comment.
There didn't seem to be a suitable existing location for things like this other than tools/, which seems a bit cluttered and unfocused. We can discuss where to put this app.
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #3988 +/- ##
==========================================
- Coverage 75.22% 67.05% -8.17%
==========================================
Files 266 282 +16
Lines 42932 67049 +24117
==========================================
+ Hits 32294 44963 +12669
- Misses 10638 22086 +11448
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| } | ||
|
|
||
| // Instantiate the AKV Provider to ensure its assembly is present. | ||
| #pragma warning disable CA1806 |
There was a problem hiding this comment.
Nit: The only purpose of this instantiation is to force-load the AKV assembly and catch dependency conflicts. Creating a full SqlColumnEncryptionAzureKeyVaultProvider with a DefaultAzureCredential is heavier than needed — it allocates a credential object that's never used and requires suppressing CA1806.
A lighter alternative that makes the intent more explicit:
// Force-load the AKV provider assembly to detect transitive dependency conflicts.
_ = typeof(SqlColumnEncryptionAzureKeyVaultProvider).Assembly;
No warning suppression needed, no credential created, and the comment explains why.
Description
Adds a sample app for testing Azure authentication with flexibility to supply published and local SqlClient packages.