Skip to content

Commit 3d3230d

Browse files
committed
Hotfix for Azure Key Vault tests
1 parent bbe8410 commit 3d3230d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/AKVTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public AKVTest(SQLSetupStrategyAzureKeyVault fixture)
2929
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringSetupForAE), nameof(DataTestUtility.IsAKVSetupAvailable))]
3030
public void TestEncryptDecryptWithAKV()
3131
{
32-
SqlConnectionStringBuilder builder = new(DataTestUtility.TCPConnectionStringHGSVBS)
32+
SqlConnectionStringBuilder builder = new(DataTestUtility.TCPConnectionString)
3333
{
3434
ColumnEncryptionSetting = SqlConnectionColumnEncryptionSetting.Enabled,
3535
AttestationProtocol = SqlConnectionAttestationProtocol.NotSpecified,
@@ -70,7 +70,7 @@ It aims to confirm that three consecutive connections will consistently fail wit
7070
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringSetupForAE), nameof(DataTestUtility.IsAKVSetupAvailable))]
7171
public void ForcedColumnDecryptErrorTestShouldFail()
7272
{
73-
SqlConnectionStringBuilder builder = new(DataTestUtility.TCPConnectionStringHGSVBS)
73+
SqlConnectionStringBuilder builder = new(DataTestUtility.TCPConnectionString)
7474
{
7575
ColumnEncryptionSetting = SqlConnectionColumnEncryptionSetting.Enabled,
7676
AttestationProtocol = SqlConnectionAttestationProtocol.NotSpecified,
@@ -148,7 +148,7 @@ public void TestRoundTripWithAKVAndCertStoreProvider()
148148
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringSetupForAE), nameof(DataTestUtility.IsAKVSetupAvailable))]
149149
public void TestLocalCekCacheIsScopedToProvider()
150150
{
151-
SqlConnectionStringBuilder builder = new(DataTestUtility.TCPConnectionStringHGSVBS)
151+
SqlConnectionStringBuilder builder = new(DataTestUtility.TCPConnectionString)
152152
{
153153
ColumnEncryptionSetting = SqlConnectionColumnEncryptionSetting.Enabled,
154154
AttestationProtocol = SqlConnectionAttestationProtocol.NotSpecified,

src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Fixtures/CertificateFixtureBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ protected static X509Certificate2 CreateCertificate(string subjectName, IEnumera
101101
{{
102102
$x509 = PKI\New-SelfSignedCertificate -Subject $subject -TextExtension $sAN -KeyLength 2048 -KeyAlgorithm RSA `
103103
-CertStoreLocation ""Cert:\CurrentUser\My"" -NotBefore $notBefore -NotAfter $notAfter `
104-
-KeyExportPolicy Exportable -HashAlgorithm SHA256
104+
-KeyExportPolicy Exportable -HashAlgorithm SHA256 -Provider ""Microsoft Enhanced RSA and AES Cryptographic Provider"" -KeySpec KeyExchange
105105
106106
if ($x509 -eq $null)
107107
{{ throw ""Certificate was null!"" }}
@@ -166,7 +166,7 @@ exit 1
166166
// Process completed successfully if it had an exit code of zero, the command output will be the base64-encoded certificate
167167
if (psProcess.ExitCode == 0)
168168
{
169-
return new X509Certificate2(Convert.FromBase64String(commandOutput), password);
169+
return new X509Certificate2(Convert.FromBase64String(commandOutput), password, X509KeyStorageFlags.Exportable);
170170
}
171171
else
172172
{

0 commit comments

Comments
 (0)