Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 6 additions & 16 deletions doc/apps/AzureAuthentication/App.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Diagnostics;

using Azure.Identity;
using Microsoft.Data.SqlClient;
using Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider;

Expand Down Expand Up @@ -82,15 +81,6 @@ internal int Run(RunOptions options)
Authentication: {builder.Authentication}

""");

if (options.Verbose)
{
Out($"""
Full connection string:
{builder}

""");
}
}
catch (Exception ex)
{
Expand All @@ -109,10 +99,9 @@ internal int Run(RunOptions options)
// Enable SqlClient event logging if requested.
if (options.LogEvents)
{
string prefix = "[EVENT]";
Out($"SqlClient event logging enabled; events will be prefixed with {prefix}");
Out($"SqlClient event logging enabled; events will be prefixed with {SqlClientEventListener.Prefix}");

_eventListener = new SqlClientEventListener(Out, prefix);
_eventListener = new SqlClientEventListener(Out, SqlClientEventListener.Prefix);
}

// Pause for trace attachment if requested.
Expand All @@ -127,9 +116,10 @@ internal int Run(RunOptions options)
Console.ReadLine();
}

// Instantiate the AKV Provider to ensure its assembly is present, loadable, contains the
// expected types, and at least the constructor functions.
_ = new SqlColumnEncryptionAzureKeyVaultProvider(new DefaultAzureCredential(true));
// Load the AKV Provider assembly to ensure it is present, loadable, and contains the
// expected types. This is a lightweight check that detects transitive dependency conflicts
// without allocating a credential or invoking any external service.
_ = typeof(SqlColumnEncryptionAzureKeyVaultProvider).Assembly;

try
{
Expand Down
6 changes: 4 additions & 2 deletions doc/apps/AzureAuthentication/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Supply specific package versions when building to test different versions of the
verboseOption
};

int exitCode = 0;
rootCommand.SetAction(parseResult =>
{
App.RunOptions options = new()
Expand All @@ -77,9 +78,10 @@ Supply specific package versions when building to test different versions of the
};

using App app = new();
return app.Run(options);
exitCode = app.Run(options);
});

return rootCommand.Parse(args).Invoke();
rootCommand.Parse(args).Invoke();
return exitCode;
}
}
6 changes: 3 additions & 3 deletions doc/apps/AzureAuthentication/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ Package versions are controlled through MSBuild properties. Pass them on the com

| Property | Default | Description |
| --- | --- | --- |
| `SqlClientVersion` | `6.1.4` | Version of `Microsoft.Data.SqlClient` to reference. |
| `AkvProviderVersion` | `6.1.2` | Version of `Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider` to reference. |
| `SqlClientVersion` | `7.0.0-preview4.26064.3` | Version of `Microsoft.Data.SqlClient` to reference. |
| `AkvProviderVersion` | `7.0.0-preview1.26064.3` | Version of `Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider` to reference. |
| `AzureVersion` | None | Version of `Microsoft.Data.SqlClient.Extensions.Azure` to reference. When omitted, the `Azure` package will not be referenced. |

## Local Package Source
Expand Down Expand Up @@ -68,7 +68,7 @@ Description:

Supply specific package versions when building to test different versions of the SqlClient suite, for example:

-p:SqlClientVersion=7.0.0.preview4
-p:SqlClientVersion=7.0.0-preview4
-p:AkvProviderVersion=7.0.1-preview2
-p:AzureVersion=1.0.0-preview1

Expand Down
10 changes: 10 additions & 0 deletions doc/apps/AzureAuthentication/SqlClientEventListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ internal SqlClientEventListener(Action<string> output, string prefix)

#endregion

// ──────────────────────────────────────────────────────────────────
#region Constants

/// <summary>
/// The default prefix prepended to each emitted event message.
/// </summary>
internal const string Prefix = "[EVENT]";

#endregion

// ──────────────────────────────────────────────────────────────────
#region Derived Methods

Expand Down
2 changes: 1 addition & 1 deletion doc/apps/AzureAuthentication/packages/.gitkeep
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# 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
# because it is declared in our NuGet.config.
1 change: 1 addition & 0 deletions src/Microsoft.Data.SqlClient.sln
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Data.SqlClient", "Microsoft.Data.SqlClient\src\Microsoft.Data.SqlClient.csproj", "{AA77C107-9A78-4A99-98BB-21FF7A1E0B01}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureAuthentication", "..\doc\apps\AzureAuthentication\AzureAuthentication.csproj", "{C3FE67C1-D288-45ED-A35C-08107396F8BB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "notsupported", "notsupported", "{351BE847-A0BF-450C-A5BC-8337AFA49EAA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Data.SqlClient", "Microsoft.Data.SqlClient\notsupported\Microsoft.Data.SqlClient.csproj", "{1DB299CE-95EA-4566-84DD-171768758291}"
Expand Down