Skip to content

Huge build size regression due to added broker support #4410

Closed as not planned

Description

@dallmair

Describe the bug

We're using Microsoft.Data.SqlClient in a cloud service running on Linux x64 in containers. With the upgrade to the newly released version 6.1.6 (also happens with 7.0.2), our container size increased a lot.

#4288 added broker support for interactive Entra ID auth. To implement this, the Microsoft.Data.SqlClient.Extensions.Azure package gained a dependency on Microsoft.Identity.Client.Broker.

This is the crux: In a cloud service, we don't have interactive auth anyway, and the PR even explicitly states

Non-Windows: broker is never used.

Thus, it should be possible to have a build without all the binaries needed for broker support as that is all dead code in our case, but the build doesn't know and puts all the binaries there all the time.

To reproduce

Create a new .NET 10 console application project and add references to Microsoft.Data.SqlClient 7.0.1 and Microsoft.Data.SqlClient.Extensions.Azure 1.0.0. Compile the project and check the output directory size.

Then, upgrade the Microsoft.Data.SqlClient* dependencies to 7.0.2, rebuild the project, and check the output directory size again.

On my system (Release configuration):

Version Size in bytes
7.0.1 + 1.0.0 15,607,664
7.0.2 78,921,330

To be fair, in a production build one would use dotnet publish --runtime linux-x64 which brings down the output to 48,494,987 bytes, but that's still a whopping 32 MiB more than with the previous version.

Expected behavior

I'm able to choose whether I want to have broker support or not by being able to install a dedicated package that adds broker support if needed.

Further technical details

Microsoft.Data.SqlClient version: 7.0.2
.NET target: .NET 10.0
SQL Server version: -
Operating system: -

Additional context
-

Activity

  1. github-actions commented on Jun 26, 2026

    @github-actions

    🔍 Triage Summary

    Check Result
    Issue type Feature
    Environment All required environment details provided for investigation
    Area Area\Azure Connectivity
    Duplicates None found
    Regression Likely regression from v7.0.1 → v7.0.2 (introduced by #4288)

    Analysis

    PR #4288 added Windows Account Manager (WAM) broker support to Microsoft.Data.SqlClient.Extensions.Azure by adding a hard dependency on Microsoft.Identity.Client.Broker, which pulls in ~30–63 MB of additional native binaries. Since the PR itself states that broker support is never used on non-Windows platforms, this dependency is dead weight for Linux/macOS cloud services — causing a ~5× binary size increase (15.6 MB → 78.9 MB uncompressed, or +32 MiB with --runtime linux-x64 publish). The feature itself works correctly; the issue is that the broker dependency is unconditional rather than opt-in, which affects container size and deployment costs for all non-interactive service workloads. Severity: P2 — significant impact on cloud/container deployment scenarios.

    Next Steps

    • Assign to Copilot coding agent to investigate splitting broker support into a separate opt-in package (e.g., Microsoft.Data.SqlClient.Extensions.Azure.Broker) or using RID-specific/platform-conditional <PackageReference> in the .csproj/.nuspec to make Microsoft.Identity.Client.Broker a Windows-only dependency that does not flow to Linux/macOS publish outputs.
    • Specifically investigate whether <PackageReference Include="Microsoft.Identity.Client.Broker" Condition="'$(RuntimeIdentifier)' == 'win-x64' ..." /> or <group targetFramework="... /runtime-windows/" /> in the nuspec can gate the transitive dependency, and validate that the existing WAM broker code paths still compile with a guard.
    • Coordinate with the Enable WAM Broker support for Entra ID Auth modes #4288 authors (PR is targeted for Hotfix 7.0.3) to determine whether a fix can be included in 7.0.3 or should target 7.1.0.

    Note: This triage summary is auto-generated by an AI agent. The analysis and suggestions above have not been verified by a human maintainer. Please treat as preliminary guidance only.

    Generated by SqlClient Issue Auto-Triage for issue #4410 · 39.2 AIC · ⌖ 7.4 AIC · ⊞ 8.4K · ◷

  2. edwardneal commented on Jun 28, 2026

    @edwardneal
    Contributor

    To add to this - is it definitely correct to say that the broker only works on Windows? This article seems to indicate that as long as the OS runs the microsoft-identity-broker package, MSAL is capable of supporting the broker.

    If so, the triage bot's proposal of a RID-specific dependency wouldn't actually address the size issue - it'd just mask it away from Linux until someone asks for the library to enable OS-independent broker support.

  3. jopa-vrb commented on Jun 29, 2026

    @jopa-vrb

    We have the same issue with the upgrade from 6.1.5 to 6.1.6.
    One of our repos, hosting over a hundred dotnet projects and producing about 20 Docker images, can no longer be built on Microsoft hosted agents while referencing the new version. The total disk space usage for the build (dotnet publish and Docker compose) has ballooned by about 8 gigabytes.

  4. mdaigle commented on Jun 30, 2026

    @mdaigle
    Contributor

    Thanks for reporting the situation. We are aware that the new dependency increases the package size and it's certainly not ideal. Unfortunately, our options are limited due to the fact that the default Entra ID application in the Microsoft.Data.SqlClient.Extensions.Azure package is a Microsoft first party app. Microsoft requires specific configuration for first party apps to maintain a strong security posture. It would be untenable for us to publish a separate package per auth-related library to isolate any potential changes. We try to maintain default implementations that work for most use cases and provide extension points for customers should the defaults not meet their needs.

    Now that most auth dependencies are split out into the Microsoft.Data.SqlClient.Extensions.Azure package, you have the flexibility to skip all of our default auth implementations and dependencies and use your own token acquisition logic. Of the two options, I typically recommend using the AccessTokenCallback because it's a lighter weight API.

    1. Custom SqlAuthenticationProvider
    2. AccessTokenCallback

    Implementing one of these will let you skip the Microsoft.Data.SqlClient.Extensions.Azure dependency (and the new broker dependency) entirely. You will be in control of the MSAL version and configurations you use.

    Hopefully this gives some ideas for paths forward, but please reach out if you have any questions.

  5. moved this from To triage to Done in SqlClient Boardon Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions