diff --git a/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml b/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml index 2111df9687..c0cc0ad521 100644 --- a/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml +++ b/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml @@ -91,14 +91,22 @@ extends: featureFlags: WindowsHostVersion: 1ESWindows2022 globalSdl: # https://aka.ms/obpipelines/sdl + tsa: + # The OneBranch template will set 'break' to false for the other SDL + # tools when TSA is enabled. This allows TSA to gather the results + # and publish them for downstream analysis. + enabled: ${{parameters.enableAllSdlTools }} apiscan: - enabled: ${{ not(parameters['isPreview']) }} + enabled: ${{parameters.enableAllSdlTools }} + # For non-official builds, the OneBranch template seems to set APIScan's + # 'break' to true even when TSA is enabled. We don't want APIScan to + # break non-official builds, so we explicitly set 'break' to false here. + ${{ if ne(parameters.oneBranchType, 'Official') }}: + break: false softwareFolder: $(softwareFolder) symbolsFolder: $(symbolsFolder) softwarename: Microsoft.Data.SqlClient versionNumber: $(AssemblyFileVersion) - tsa: - enabled: ${{ not(parameters['isPreview']) }} # onebranch publish all sdl results to TSA. If TSA is disabled all SDL tools will forced into 'break' build mode. codeql: compiled: enabled: ${{ not(parameters['isPreview']) }} diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 17920baab7..214bcc3320 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -71,7 +71,17 @@ $(DefineConstants);ENCLAVE_SIMULATOR - + + + + false + all diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ActiveDirectoryAuthenticationProvider.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ActiveDirectoryAuthenticationProvider.cs index a4982981f2..8601d1f1ee 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ActiveDirectoryAuthenticationProvider.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ActiveDirectoryAuthenticationProvider.cs @@ -10,6 +10,7 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Identity; +using Microsoft.Data.Common; using Microsoft.Extensions.Caching.Memory; using Microsoft.Identity.Client; using Microsoft.Identity.Client.Extensibility; @@ -542,31 +543,24 @@ private static bool AreEqual(byte[] a1, byte[] a2) private IPublicClientApplication CreateClientAppInstance(PublicClientAppKey publicClientAppKey) { - IPublicClientApplication publicClientApplication; - -#if NETFRAMEWORK - if (_iWin32WindowFunc != null) - { - publicClientApplication = PublicClientApplicationBuilder.Create(publicClientAppKey._applicationClientId) - .WithAuthority(publicClientAppKey._authority) - .WithClientName(Common.DbConnectionStringDefaults.ApplicationName) - .WithClientVersion(Common.ADP.GetAssemblyVersion().ToString()) - .WithRedirectUri(publicClientAppKey._redirectUri) - .WithParentActivityOrWindow(_iWin32WindowFunc) - .Build(); - } - else -#endif + PublicClientApplicationBuilder builder = PublicClientApplicationBuilder + .CreateWithApplicationOptions(new PublicClientApplicationOptions + { + ClientId = publicClientAppKey._applicationClientId, + ClientName = DbConnectionStringDefaults.ApplicationName, + ClientVersion = ADP.GetAssemblyVersion().ToString(), + RedirectUri = publicClientAppKey._redirectUri, + }) + .WithAuthority(publicClientAppKey._authority); + + #if NETFRAMEWORK + if (_iWin32WindowFunc is not null) { - publicClientApplication = PublicClientApplicationBuilder.Create(publicClientAppKey._applicationClientId) - .WithAuthority(publicClientAppKey._authority) - .WithClientName(Common.DbConnectionStringDefaults.ApplicationName) - .WithClientVersion(Common.ADP.GetAssemblyVersion().ToString()) - .WithRedirectUri(publicClientAppKey._redirectUri) - .Build(); + builder.WithParentActivityOrWindow(_iWin32WindowFunc); } + #endif - return publicClientApplication; + return builder.Build(); } private static TokenCredentialData CreateTokenCredentialInstance(TokenCredentialKey tokenCredentialKey, string secret)