Skip to content

Commit 325ca56

Browse files
Deprecate 'Active Directory Password' authentication mode. (#3219)
1 parent e0fa87b commit 325ca56

File tree

18 files changed

+51
-5
lines changed

18 files changed

+51
-5
lines changed

doc/snippets/Microsoft.Data.SqlClient/ActiveDirectoryAuthenticationProvider.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
<remarks>
181181
The supported authentication modes with <see cref="T:Microsoft.Data.SqlClient.ActiveDirectoryAuthenticationProvider" /> are:
182182
<list type="bullet">
183-
<item>Active Directory Password</item>
183+
<item>Active Directory Password (deprecated)</item>
184184
<item>Active Directory Integrated</item>
185185
<item>Active Directory Interactive</item>
186186
<item>Active Directory Service Principal</item>

doc/snippets/Microsoft.Data.SqlClient/SqlAuthenticationMethod.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<value>1</value>
1313
</SqlPassword>
1414
<ActiveDirectoryPassword>
15-
<summary>The authentication method uses Active Directory Password. Use Active Directory Password to connect to a SQL Database using a Microsoft Entra principal name and password.</summary>
15+
<summary>The authentication method uses Active Directory Password. Use Active Directory Password to connect to a SQL Database using a Microsoft Entra principal name and password. This authentication method is now deprecated, and will be removed in a future release.</summary>
1616
<value>2</value>
1717
</ActiveDirectoryPassword>
1818
<ActiveDirectoryIntegrated>

doc/snippets/Microsoft.Data.SqlClient/SqlConnection.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,9 +1330,9 @@
13301330
Valid values are:
13311331
</para>
13321332
<list type="bullet">
1333+
<item><c>Active Directory Password (deprecated)</c></item>
13331334
<item><c>Active Directory Integrated</c></item>
13341335
<item><c>Active Directory Interactive</c></item>
1335-
<item><c>Active Directory Password</c></item>
13361336
<item><c>Active Directory Service Principal</c></item>
13371337
<item><c>Active Directory Device Code Flow</c></item>
13381338
<item><c>Active Directory Managed Identity</c></item>
@@ -1874,7 +1874,7 @@
18741874
<item>.database.windows.net</item>
18751875
</list>
18761876
</item>
1877-
<item><c>Authentication</c> is 'Active Directory Password' or 'Active Directory Integrated'</item>
1877+
<item><c>Authentication</c> is one of the 'Active Directory' authentication types.</item>
18781878
</list>
18791879
</item>
18801880
<item><c>true</c> in all other cases.</item>

doc/snippets/Microsoft.Data.SqlClient/SqlConnectionStringBuilder.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1641,7 +1641,7 @@
16411641
</list>
16421642
</item>
16431643
<item>
1644-
<c>Authentication</c> is 'Active Directory Password' or 'Active Directory Integrated'
1644+
<c>Authentication</c> is one of the 'Active Directory' authentication types.
16451645
</item>
16461646
<item>Otherwise it defaults to <c>true</c>.</item>
16471647
</list>

src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ public enum SqlAuthenticationMethod
190190
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlAuthenticationMethod.xml' path='docs/members[@name="SqlAuthenticationMethod"]/SqlPassword/*'/>
191191
SqlPassword = 1,
192192
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlAuthenticationMethod.xml' path='docs/members[@name="SqlAuthenticationMethod"]/ActiveDirectoryPassword/*'/>
193+
[System.Obsolete("ActiveDirectoryPassword is deprecated.")]
193194
ActiveDirectoryPassword = 2,
194195
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlAuthenticationMethod.xml' path='docs/members[@name="SqlAuthenticationMethod"]/ActiveDirectoryIntegrated/*'/>
195196
ActiveDirectoryIntegrated = 3,

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2001,7 +2001,9 @@ private bool TryOpen(TaskCompletionSource<DbConnectionInternal> retry, SqlConnec
20012001

20022002
if (connectionOptions != null &&
20032003
(connectionOptions.Authentication == SqlAuthenticationMethod.SqlPassword ||
2004+
#pragma warning disable 0618
20042005
connectionOptions.Authentication == SqlAuthenticationMethod.ActiveDirectoryPassword ||
2006+
#pragma warning restore 0618
20052007
connectionOptions.Authentication == SqlAuthenticationMethod.ActiveDirectoryServicePrincipal) &&
20062008
(!connectionOptions._hasUserIdKeyword || !connectionOptions._hasPasswordKeyword) &&
20072009
_credential == null)

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,9 @@ private void Login(ServerInfo server, TimeoutTimer timeout, string newPassword,
13291329
// If the workflow being used is Active Directory Authentication and server's prelogin response
13301330
// for FEDAUTHREQUIRED option indicates Federated Authentication is required, we have to insert FedAuth Feature Extension
13311331
// in Login7, indicating the intent to use Active Directory Authentication for SQL Server.
1332+
#pragma warning disable 0618
13321333
if (ConnectionOptions.Authentication == SqlAuthenticationMethod.ActiveDirectoryPassword
1334+
#pragma warning restore 0618
13331335
|| ConnectionOptions.Authentication == SqlAuthenticationMethod.ActiveDirectoryInteractive
13341336
|| ConnectionOptions.Authentication == SqlAuthenticationMethod.ActiveDirectoryDeviceCodeFlow
13351337
|| ConnectionOptions.Authentication == SqlAuthenticationMethod.ActiveDirectoryServicePrincipal
@@ -2486,7 +2488,9 @@ internal SqlFedAuthToken GetFedAuthToken(SqlFedAuthInfo fedAuthInfo)
24862488
_activeDirectoryAuthTimeoutRetryHelper.CachedToken = _fedAuthToken;
24872489
}
24882490
break;
2491+
#pragma warning disable 0618
24892492
case SqlAuthenticationMethod.ActiveDirectoryPassword:
2493+
#pragma warning restore 0618
24902494
case SqlAuthenticationMethod.ActiveDirectoryServicePrincipal:
24912495
if (_activeDirectoryAuthTimeoutRetryHelper.State == ActiveDirectoryAuthenticationTimeoutRetryState.Retrying)
24922496
{

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8314,7 +8314,9 @@ internal int WriteFedAuthFeatureRequest(FederatedAuthenticationFeatureExtensionD
83148314
byte workflow = 0x00;
83158315
switch (fedAuthFeatureData.authentication)
83168316
{
8317+
#pragma warning disable 0618
83178318
case SqlAuthenticationMethod.ActiveDirectoryPassword:
8319+
#pragma warning restore 0618
83188320
workflow = TdsEnums.MSALWORKFLOW_ACTIVEDIRECTORYPASSWORD;
83198321
break;
83208322
case SqlAuthenticationMethod.ActiveDirectoryIntegrated:

src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ public enum SqlAuthenticationMethod
129129
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlAuthenticationMethod.xml' path='docs/members[@name="SqlAuthenticationMethod"]/SqlPassword/*'/>
130130
SqlPassword = 1,
131131
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlAuthenticationMethod.xml' path='docs/members[@name="SqlAuthenticationMethod"]/ActiveDirectoryPassword/*'/>
132+
[System.Obsolete("ActiveDirectoryPassword is deprecated.")]
132133
ActiveDirectoryPassword = 2,
133134
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlAuthenticationMethod.xml' path='docs/members[@name="SqlAuthenticationMethod"]/ActiveDirectoryIntegrated/*'/>
134135
ActiveDirectoryIntegrated = 3,

src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2058,7 +2058,9 @@ private bool TryOpen(TaskCompletionSource<DbConnectionInternal> retry, SqlConnec
20582058

20592059
if (connectionOptions != null &&
20602060
(connectionOptions.Authentication == SqlAuthenticationMethod.SqlPassword ||
2061+
#pragma warning disable 0618
20612062
connectionOptions.Authentication == SqlAuthenticationMethod.ActiveDirectoryPassword ||
2063+
#pragma warning restore 0618
20622064
connectionOptions.Authentication == SqlAuthenticationMethod.ActiveDirectoryServicePrincipal) &&
20632065
(!connectionOptions._hasUserIdKeyword || !connectionOptions._hasPasswordKeyword) &&
20642066
_credential == null)

0 commit comments

Comments
 (0)