Skip to content

Add assembly signing for Microsoft.SqlServer.Server - #4566

Draft
paulmedynski wants to merge 2 commits into
mainfrom
dev/paul/assembly-signing-sqlserver
Draft

Add assembly signing for Microsoft.SqlServer.Server#4566
paulmedynski wants to merge 2 commits into
mainfrom
dev/paul/assembly-signing-sqlserver

Conversation

@paulmedynski

@paulmedynski paulmedynski commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

What's This All About?

The first 5 PRs in this stack are all about adding assembly signing and public-key-protected InternalsVisibleTo support to the legacy CI pipeline. This is infrastructure work necessary to support the Native AOT fix in the final PR.

We have never been including assembly signing in our CI, which IMO was a blind spot. Now, when CI runs in our internal ADO.Net project, all assemblies will be signed, we will be running tests against signed assemblies, and fully testing our nascent inter-assembly IVT just as it would be in a real app. Public project CI and all of our PR pipelines will continue to use unsigned assemblies, and testing that requires inter-assembly IVT will only be done in Project mode (PR, legacy CI Project-mode pipeline) or via internal CI with signed assemblies.

The 6th and final PR in the stack addresses the Native AOT issue #4193 by eliminating inter-assembly reflection and using signed IVT with proper package dependencies.

Description

This PR sets up assembly signing in the legacy CI pipeline for the SqlServer project. Microsoft.SqlServer.Server was not receiving SigningKeyPath when it was packed by the internal, Package-reference CI flow. As a result, that package could be produced without the strong-name signing applied to the other internal package artifacts. Internal Package-mode builds need a consistent set of signed assemblies; public builds and Project-reference builds should continue to build without access to the internal signing key.

This PR:

  • adds a reusable pipeline step for downloading either the driver or test assembly-signing key from Azure DevOps secure files;
  • updates the existing internal package and OneBranch flows to use the shared step and a consistent driverKeyFile output name;
  • threads isInternalBuild and referenceType through the CI core, SqlServer stage, and SqlServer pack job;
  • downloads the driver key and passes SigningKeyPath when packing Microsoft.SqlServer.Server only for internal Package-reference builds; and
  • leaves public and Project-reference builds unsigned and unchanged.

Supplying SigningKeyPath activates the existing signing behavior in src/Directory.Build.props; this PR does not change product source, public APIs, package contents beyond assembly signing, or compatibility behavior.

Issues

Works towards addressing #4193.

Testing

This is a pipeline-only change, so no unit or integration tests were added.

The GitHub PR validation pipelines exercise the public Package-reference and Project-reference paths and are currently running. The internal signing branch requires the ADO.Net secure file and is exercised only by an internal Package-reference pipeline run.

Copilot AI lite review requested due to automatic review settings August 21, 2026 14:38
@github-project-automation github-project-automation Bot moved this to To triage in SqlClient Board Aug 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Azure DevOps pipeline templates to enable strong-name (assembly) signing for Microsoft.SqlServer.Server in internal build scenarios, and centralizes secure-file key download logic into a reusable step template.

Changes:

  • Added a shared download-assembly-signing-key.yml step template to download signing keys from secure files.
  • Threaded isInternalBuild (and referenceType) through the CI core → SqlServer stage/job to conditionally apply SigningKeyPath during packing.
  • Updated OneBranch build steps and the internal package CI pipeline to use the shared download template and the new driverKeyFile reference.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
eng/pipelines/stages/build-sqlserver-package-ci-stage.yml Adds referenceType / isInternalBuild parameters and forwards them to the SqlServer pack job.
eng/pipelines/onebranch/steps/build-buildproj-step.yml Switches to the shared signing-key download template and uses driverKeyFile.secureFilePath.
eng/pipelines/onebranch/jobs/validate-signed-package-job.yml Comment wording tweak around strong-name signing verification.
eng/pipelines/jobs/pack-sqlserver-package-ci-job.yml Conditionally downloads signing key + passes SigningKeyPath for internal Package-mode packing.
eng/pipelines/dotnet-sqlclient-ci-project-reference-pipeline.yml Passes isInternalBuild into the core template based on System.TeamProject.
eng/pipelines/dotnet-sqlclient-ci-package-reference-pipeline.yml Passes isInternalBuild into the core template based on System.TeamProject.
eng/pipelines/dotnet-sqlclient-ci-core.yml Introduces isInternalBuild parameter and forwards it into the SqlServer build stage.
eng/pipelines/common/steps/download-assembly-signing-key.yml New reusable step template to download driver/test SNK secure files.
eng/pipelines/ci/package/sqlclient-ci-package-pipeline.yml Uses the shared signing-key download template in internal package CI pipeline.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread eng/pipelines/jobs/pack-sqlserver-package-ci-job.yml Outdated
inputs:
secureFile: netfxKeypair.snk
name: driverKeyFile
- template: /eng/pipelines/common/steps/download-assembly-signing-key.yml@self

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR adds a shared helper template to download signing keys, so you will see changes to several pipeline like this.

- Project

# True when building on the internal ADO.Net project.
- name: isInternalBuild

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will see this concept throughout the PR stack, used to determine when assembly signing is required.

The PR pipelines (legacy and modern) always use Project mode, and never sign any assemblies. They will not have this concept.

The modern CI pipeline always uses Package mode, and when running on ADO.Net, it will sign all assemblies (driver and test).

The legacy CI pipelines use both Project and Package mode. In Project mode, no signing occurs, so internal vs public doesn't matter. In Package mode and internal, we will be signing everything to satisfy InternalsVisibleTo safely.

Comment thread eng/pipelines/jobs/pack-sqlserver-package-ci-job.yml Outdated
Introduce the shared signing-key download step and thread isInternalBuild
through the CI core so the SqlServer package is strong-name signed on internal
Package-mode builds.

- Add eng/pipelines/common/steps/download-assembly-signing-key.yml, which
  exports driverKeyFile or testKeyFile from ADO secure files.
- Adopt that step in the OneBranch build and nightly CI package pipelines,
  renaming keyFile to driverKeyFile.
- Declare isInternalBuild in dotnet-sqlclient-ci-core.yml and set it from the
  CI package- and project-reference pipelines.
- Sign the SqlServer package when isInternalBuild is true and referenceType is
  not Project.
Copilot AI review requested due to automatic review settings August 21, 2026 20:28
@paulmedynski
paulmedynski force-pushed the dev/paul/assembly-signing-sqlserver branch from 9bb6342 to a222a0c Compare August 21, 2026 20:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment thread eng/pipelines/jobs/pack-sqlserver-package-ci-job.yml
- Quote SigningKeyPath in buildProperties so the secure-file path is
  robust to spaces, matching build-buildproj-step.yml and
  sqlclient-ci-package-pipeline.yml.
- Move the BuildNumber/FileVersion note directly above buildProperties
  in both the signed and unsigned pack branches.

No change to signing behaviour: signing stays gated on internal
Package-reference builds.
Copilot AI review requested due to automatic review settings August 21, 2026 20:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area\Azure Connectivity Use this to tag issues that are related to Azure connectivity. Area\Engineering Use this for issues that are targeted for changes in the 'eng' folder or build systems.

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

2 participants