Skip to content

Commit 0993f35

Browse files
Merge pull request #36950 from MicrosoftDocs/main
Auto Publish – main to live - 2026-03-25 17:30 UTC
2 parents e1a67db + 6643842 commit 0993f35

11 files changed

Lines changed: 468 additions & 81 deletions

azure-sql/database/file-space-manage.md

Lines changed: 46 additions & 30 deletions
Large diffs are not rendered by default.

docs/connect/ado-net/appcontext-switches.md

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ title: AppContext switches in SqlClient
33
description: Learn about the AppContext switches available in SqlClient and how to use them to modify some default behaviors.
44
author: cheenamalhotra
55
ms.author: cmalhotra
6-
ms.date: 08/19/2025
6+
ms.date: 03/17/2026
77
ms.service: sql
88
ms.subservice: connectivity
99
ms.topic: concept-article
1010
dev_langs:
1111
- "csharp"
1212
ms.custom: sfi-ropc-nochange
13+
ai-usage: ai-assisted
1314
---
15+
1416
# AppContext switches in SqlClient
1517

1618
[!INCLUDE [dotnet-all](../../includes/products/applies-full/dotnet-all.md)]
@@ -19,6 +21,55 @@ ms.custom: sfi-ropc-nochange
1921

2022
The AppContext class allows SqlClient to provide new functionality while continuing to support callers who depend on the previous behavior. Users can opt out of a change in behavior by setting specific AppContext switches.
2123

24+
## Enable MultiSubnetFailover by default
25+
26+
[!INCLUDE [dotnet-all](../../includes/products/applies-plain/dotnet-all.md)]
27+
28+
(Available starting with version 7.0)
29+
30+
To set `MultiSubnetFailover=true` globally without modifying individual connection strings, you can set the AppContext switch **"Switch.Microsoft.Data.SqlClient.EnableMultiSubnetFailoverByDefault"** to `true` at application startup:
31+
32+
```csharp
33+
AppContext.SetSwitch("Switch.Microsoft.Data.SqlClient.EnableMultiSubnetFailoverByDefault", true);
34+
```
35+
36+
You can also enable this switch in your App.Config:
37+
38+
```xml
39+
<runtime>
40+
<AppContextSwitchOverrides value="Switch.Microsoft.Data.SqlClient.EnableMultiSubnetFailoverByDefault=true" />
41+
</runtime>
42+
```
43+
44+
When enabled, all connections behave as if `MultiSubnetFailover=true` is set in the connection string. This switch is disabled by default.
45+
46+
## Enable packet multiplexing for async reads
47+
48+
[!INCLUDE [dotnet-all](../../includes/products/applies-plain/dotnet-all.md)]
49+
50+
(Available starting with version 7.0)
51+
52+
Packet multiplexing improves performance for large async read operations such as `ExecuteReaderAsync` with big result sets, streaming scenarios, or bulk data retrieval. This feature is controlled by two opt-in AppContext switches. Setting both switches to `false` enables the new async processing path:
53+
54+
```csharp
55+
AppContext.SetSwitch("Switch.Microsoft.Data.SqlClient.UseCompatibilityAsyncBehaviour", false);
56+
AppContext.SetSwitch("Switch.Microsoft.Data.SqlClient.UseCompatibilityProcessSni", false);
57+
```
58+
59+
By default, both switches are `true`, which preserves the existing (compatible) behavior.
60+
61+
## Enable User Agent feature extension
62+
63+
[!INCLUDE [dotnet-all](../../includes/products/applies-plain/dotnet-all.md)]
64+
65+
(Available starting with version 7.0)
66+
67+
When the AppContext switch **"Switch.Microsoft.Data.SqlClient.EnableUserAgent"** is enabled, the driver sends user agent details to the server as part of the connection. This information assists with troubleshooting and quantifying driver usage by version and operating system. This switch is disabled by default. To enable it, set the AppContext switch to `true` at application startup:
68+
69+
```csharp
70+
AppContext.SetSwitch("Switch.Microsoft.Data.SqlClient.EnableUserAgent", true);
71+
```
72+
2273
## Enabling decimal truncation behavior
2374

2475
[!INCLUDE [dotnet-all](../../includes/products/applies-plain/dotnet-all.md)]

docs/connect/ado-net/download-microsoft-sqlclient-data-provider.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Download page for ADO.NET and Microsoft SqlClient Data Provider for
44
author: cheenamalhotra
55
ms.author: cmalhotra
66
ms.reviewer: randolphwest
7-
ms.date: 11/21/2025
7+
ms.date: 03/17/2026
88
ms.service: sql
99
ms.subservice: connectivity
1010
ms.topic: how-to
@@ -25,6 +25,5 @@ For more information about version compatibility and support, see [SQL version c
2525

2626
## Download supported versions of Microsoft SqlClient Data Provider for SQL Server
2727

28-
- [6.1.3](https://www.nuget.org/packages/Microsoft.Data.SqlClient/6.1.3)
29-
- [6.0.4](https://www.nuget.org/packages/Microsoft.Data.SqlClient/6.0.4)
30-
- [5.1.8](https://www.nuget.org/packages/Microsoft.Data.SqlClient/5.1.8)
28+
- [7.0.0](https://www.nuget.org/packages/Microsoft.Data.SqlClient/7.0.0)
29+
- [6.1.4](https://www.nuget.org/packages/Microsoft.Data.SqlClient/6.1.4)

docs/connect/ado-net/introduction-microsoft-data-sqlclient-namespace.md

Lines changed: 261 additions & 13 deletions
Large diffs are not rendered by default.

docs/connect/ado-net/microsoft-ado-net-sql-server.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,3 @@ ADO.NET is the core data access technology for .NET languages. Use the Microsoft
6262
## More samples
6363

6464
* [ADO.NET Code Examples](/dotnet/framework/data/adonet/ado-net-code-examples)
65-

docs/connect/ado-net/sql/azure-active-directory-authentication.md

Lines changed: 78 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
---
22
title: Connect to Azure SQL with Microsoft Entra authentication and SqlClient
33
description: Describes how to use supported Microsoft Entra authentication modes to connect to Azure SQL data sources with SqlClient
4-
author: David-Engel
5-
ms.author: davidengel
4+
author: cheenamalhotra
5+
ms.author: cmalhotra
66
ms.reviewer: davidengel
7-
ms.date: 01/16/2026
7+
ms.date: 03/17/2026
88
ms.service: sql
99
ms.subservice: connectivity
1010
ms.topic: integration
1111
dev_langs:
1212
- "csharp"
13+
ai-usage: ai-assisted
1314
---
1415

1516
# Connect to Azure SQL with Microsoft Entra authentication and SqlClient
@@ -26,13 +27,17 @@ This article describes how to connect to Azure SQL data sources by using Microso
2627

2728
Microsoft Entra authentication uses identities in Microsoft Entra ID to access data sources such as Azure SQL Database, Azure SQL Managed Instance, and Azure Synapse Analytics. The **Microsoft.Data.SqlClient** namespace allows client applications to specify Microsoft Entra credentials in different authentication modes when they're connecting to Azure SQL Database and Azure SQL Managed Instance. To use Microsoft Entra authentication with Azure SQL, you must [configure and manage Microsoft Entra authentication with Azure SQL](/azure/azure-sql/database/authentication-aad-configure).
2829

30+
> [!IMPORTANT]
31+
> Starting with **Microsoft.Data.SqlClient 7.0**, Azure and Microsoft Entra ID dependencies are no longer included in the core `Microsoft.Data.SqlClient` package. If your library or application supports any Microsoft Entra authentication mode (such as `Active Directory Default`, `Active Directory Managed Identity`, `Active Directory Interactive`, etc.), you must include a dependency on the **Microsoft.Data.SqlClient.Extensions.Azure** NuGet package. For migration steps, see [Migrate to Microsoft.Data.SqlClient 7.0](#migrate-to-microsoftdatasqlclient-70).
32+
2933
When you set the `Authentication` connection property in the connection string, the client can choose a preferred Microsoft Entra authentication mode according to the value provided:
3034

3135
- The earliest **Microsoft.Data.SqlClient** version supports `Active Directory Password` [DEPRECATED] for .NET Framework, .NET Core, and .NET Standard. It also supports `Active Directory Integrated` authentication and `Active Directory Interactive` authentication for .NET Framework.
3236
- Starting with **Microsoft.Data.SqlClient** 2.0.0, support for `Active Directory Integrated` authentication and `Active Directory Interactive` authentication is extended across .NET Framework, .NET Core, and .NET Standard.
3337

3438
A new `Active Directory Service Principal` authentication mode is also added in SqlClient 2.0.0. It makes use of the client ID and secret of a service principal identity to accomplish authentication.
3539
- More authentication modes are added in **Microsoft.Data.SqlClient** 2.1.0, including `Active Directory Device Code Flow` and `Active Directory Managed Identity` (also known as `Active Directory MSI`). These new modes enable the application to acquire an access token to connect to the server.
40+
- Starting with **Microsoft.Data.SqlClient** 7.0.0, Microsoft Entra authentication support is provided through the separate `Microsoft.Data.SqlClient.Extensions.Azure` package. The core driver package no longer carries Azure dependencies.
3641

3742
For information about Microsoft Entra authentication beyond what the following sections describe, see [Use Microsoft Entra authentication](/azure/azure-sql/database/authentication-aad-overview).
3843

@@ -51,27 +56,10 @@ When the application is connecting to Azure SQL data sources by using Microsoft
5156
| Active Directory Managed Identity, <br>Active Directory MSI | Authenticate using a Microsoft Entra system-assigned or user-assigned managed identity | 2.1.0+ |
5257
| Active Directory Default | Authenticate with a Microsoft Entra identity by using password-less and non-interactive mechanisms including managed identities, Visual Studio Code, Visual Studio, Azure CLI, etc. | 3.0.0+ |
5358
| Active Directory Workload Identity | Authenticate with a Microsoft Entra identity by using a federated User Assigned Managed Identity to connect to SQL Database from Azure client environments that are enabled for Workload Identity. | 5.2.0+ |
54-
| Active Directory Password [DEPRECATED] | Authenticate with a Microsoft Entra identity's username and password.<br/><br/>Active Directory Password is deprecated. For more information, see [Using password authentication](#using-password-authentication). | 1.0+ |
59+
| Active Directory Password [DEPRECATED] | Authenticate with a Microsoft Entra identity's username and password.<br/><br/>Active Directory Password is deprecated. For more information, see [Using password authentication](#using-password-authentication-deprecated). | 1.0+ |
5560

5661
<sup>1</sup> Before **Microsoft.Data.SqlClient** 2.0.0, `Active Directory Integrated`, and `Active Directory Interactive` authentication modes are supported only on .NET Framework.
5762

58-
## Using password authentication
59-
60-
[!INCLUDE [entra-password-auth-deprecation](../../../includes/entra-password-auth-deprecation.md)]
61-
62-
`Active Directory Password` authentication mode supports authentication to Azure data sources with Microsoft Entra ID for native or federated Microsoft Entra users. When you're using this mode, user credentials must be provided in the connection string. The following example shows how to use `Active Directory Password` authentication.
63-
64-
```csharp
65-
// Use your own server, database, user ID, and password.
66-
string ConnectionString = @"Server=demo.database.windows.net;"
67-
+ "Authentication=Active Directory Password; Encrypt=True; Database=testdb;"
68-
+ "User Id=user@domain.com; Password=<password>";
69-
70-
using (SqlConnection conn = new SqlConnection(ConnectionString)) {
71-
conn.Open();
72-
}
73-
```
74-
7563
## Using integrated authentication
7664

7765
To use `Active Directory Integrated` authentication mode, you must have an on-premises Active Directory instance that is [joined](/entra/identity/devices/concept-directory-join) to Microsoft Entra ID in the cloud. You can [federate](/azure/active-directory/hybrid/connect/whatis-fed) by using Active Directory Federation Services (AD FS), for example.
@@ -260,7 +248,7 @@ using (SqlConnection conn = new SqlConnection(ConnectionString2)) {
260248

261249
## Using default authentication
262250

263-
Available starting in version 3.0, this authentication mode widens the possibilities of user authentication. This mode extends login solutions to the client environment, Visual Studio Code, Visual Studio, Azure CLI etc.
251+
Available starting in version 3.0, this authentication mode widens the possibilities of user authentication. This mode extends sign-in solutions to the client environment, Visual Studio Code, Visual Studio, Azure CLI, etc.
264252

265253
With this authentication mode, the driver acquires a token by passing "[DefaultAzureCredential](/dotnet/api/azure.identity.defaultazurecredential)" from the Azure Identity library to acquire an access token. This mode attempts to use a set of credential types to acquire an access token in order. Depending on the version of the Azure Identity library used, the credential set varies. Version specific differences are noted in the list. For Azure Identity version specific behavior, see the [Azure.Identity API docs](/dotnet/api/azure.identity.defaultazurecredential).
266254

@@ -289,7 +277,7 @@ With this authentication mode, the driver acquires a token by passing "[DefaultA
289277
> [!NOTE]
290278
> _InteractiveBrowserCredential_ is disabled in the driver implementation of **Active Directory Default**, and **Active Directory Interactive** is the only option available to acquire a token using MFA/Interactive authentication.
291279
>
292-
> Further customization options are not available at the moment.
280+
> Further customization options aren't available at the moment.
293281
294282
The following example shows how to use **Active Directory Default** authentication.
295283

@@ -321,6 +309,23 @@ using (SqlConnection conn = new SqlConnection(ConnectionString)) {
321309
}
322310
```
323311

312+
## Using password authentication [Deprecated]
313+
314+
[!INCLUDE [entra-password-auth-deprecation](../../../includes/entra-password-auth-deprecation.md)]
315+
316+
`Active Directory Password` authentication mode supports authentication to Azure data sources with Microsoft Entra ID for native or federated Microsoft Entra users. When you're using this mode, user credentials must be provided in the connection string. The following example shows how to use `Active Directory Password` authentication.
317+
318+
```csharp
319+
// Use your own server, database, user ID, and password.
320+
string ConnectionString = @"Server=demo.database.windows.net;"
321+
+ "Authentication=Active Directory Password; Encrypt=True; Database=testdb;"
322+
+ "User Id=user@domain.com; Password=<password>";
323+
324+
using (SqlConnection conn = new SqlConnection(ConnectionString)) {
325+
conn.Open();
326+
}
327+
```
328+
324329
## Customizing Microsoft Entra authentication
325330

326331
Besides using the Microsoft Entra authentication built into the driver, **Microsoft.Data.SqlClient** 2.1.0 and later provide applications the option to customize Microsoft Entra authentication. The customization is based on the `ActiveDirectoryAuthenticationProvider` class, which is derived from the [`SqlAuthenticationProvider`](/dotnet/api/microsoft.data.sqlclient.sqlauthenticationprovider) abstract class.
@@ -420,7 +425,57 @@ public class ActiveDirectoryAuthenticationProvider
420425
}
421426
```
422427

428+
## Migrate to Microsoft.Data.SqlClient 7.0
429+
430+
**Microsoft.Data.SqlClient 7.0** is a major release that extracts Azure and Microsoft Entra ID dependencies from the core package into a new extension package. This change was the [most upvoted open issue](https://github.com/dotnet/SqlClient/issues/1108) in the SqlClient repository. The following sections describe what changed and how to update your application.
431+
432+
### What changed in 7.0
433+
434+
- **Azure dependency extraction** — The core `Microsoft.Data.SqlClient` package no longer depends on `Azure.Core`, `Azure.Identity`, or their transitive dependencies (such as `Microsoft.Identity.Client` and `Microsoft.Web.WebView2`). The `ActiveDirectoryAuthenticationProvider` class and related types moved to the new `Microsoft.Data.SqlClient.Extensions.Azure` package.
435+
- **New packages** — Two new packages were introduced to support this separation:
436+
- `Microsoft.Data.SqlClient.Extensions.Azure` — contains Entra ID authentication support.
437+
- `Microsoft.Data.SqlClient.Extensions.Abstractions` — shared types between the core driver and extensions.
438+
- **`ActiveDirectoryPassword` deprecation**`SqlAuthenticationMethod.ActiveDirectoryPassword` is now marked `[Obsolete]` and generates a compiler warning. This aligns with [mandatory multifactor authentication](/entra/identity/authentication/concept-mandatory-multifactor-authentication).
439+
- **Actionable error messages** — If an Entra ID authentication method is used without the `Microsoft.Data.SqlClient.Extensions.Azure` package installed, the driver provides an actionable error message guiding you to install the correct package.
440+
441+
### Step 1: Install the Azure extension package
442+
443+
If your application uses any Microsoft Entra authentication mode, add the `Microsoft.Data.SqlClient.Extensions.Azure` NuGet package:
444+
445+
```dotnetcli
446+
dotnet add package Microsoft.Data.SqlClient.Extensions.Azure
447+
```
448+
449+
Or by using the NuGet Package Manager in Visual Studio, search for **Microsoft.Data.SqlClient.Extensions.Azure** and install it.
450+
451+
> [!NOTE]
452+
> No code changes are required beyond adding the package reference. The extension package registers its authentication providers automatically.
453+
454+
> [!NOTE]
455+
> You are not required to include the **Microsoft.Data.SqlClient.Extensions.Azure** package reference if your application implements the Entra ID Authentication modes itself or you connect to Azure SQL using token-based authentication. This package reference is only required for the driver-provided implementation of Entra ID authentication modes.
456+
457+
### Step 2: Replace deprecated authentication modes
458+
459+
`Active Directory Password` authentication is deprecated and generates a compiler warning in 7.0. Migrate to a supported alternative:
460+
461+
| Scenario | Recommended authentication mode |
462+
|:--|:--|
463+
| Interactive / desktop apps | `Active Directory Interactive` |
464+
| Service-to-service | `Active Directory Service Principal` |
465+
| Azure-hosted workloads | `Active Directory Managed Identity` |
466+
| Developer / CI environments | `Active Directory Default` |
467+
| Kubernetes / federated workloads | `Active Directory Workload Identity` |
468+
469+
### Step 3: Review connection strings
470+
471+
All `Authentication` connection string values continue to work the same way. No connection string changes are required for the migration, as long as the `Microsoft.Data.SqlClient.Extensions.Azure` package is installed.
472+
473+
### Applications that don't use Entra ID authentication
474+
475+
If your application connects using SQL authentication, Windows integrated authentication, or `AccessToken`/`AccessTokenCallback`, no changes are required. You benefit from a lighter core package with fewer dependencies.
476+
423477
## See also
424478

479+
- [Microsoft.Data.SqlClient 7.0 release notes](https://github.com/dotnet/SqlClient/blob/main/release-notes/7.0/7.0.0.md)
425480
- [Application and service principal objects in Microsoft Entra ID](/azure/active-directory/develop/app-objects-and-service-principals)
426481
- [Authentication flows](/azure/active-directory/develop/msal-authentication-flows)

docs/connect/ado-net/sql/sqlclient-support-always-encrypted.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ static byte[] GetEncryptedColumnEncryptonKey()
450450
{
451451
int cekLength = 32;
452452
String certificateStoreLocation = "CurrentUser";
453-
String certificateThumbprint = "698C7F8E21B2158E9AED4978ADB147CF66574180";
453+
String certificateThumbprint = "AA11BB22CC33DD44EE55FF66AA77BB88CC99DD00";
454454
// Generate the plaintext column encryption key.
455455
byte[] columnEncryptionKey = new byte[cekLength];
456456
RNGCryptoServiceProvider rngCsp = new RNGCryptoServiceProvider();

0 commit comments

Comments
 (0)