Skip to content

feat: add ADO.Net Authentication connection string synonym and spaced value names - #368

Open
David Levy (dlevy-msft-sql) wants to merge 5 commits into
microsoft:mainfrom
dlevy-msft-sql:feat/ado-net-auth-synonyms
Open

David Levy (dlevy-msft-sql) wants to merge 5 commits into
microsoft:mainfrom
dlevy-msft-sql:feat/ado-net-auth-synonyms

Conversation

@dlevy-msft-sql

Copy link
Copy Markdown

Problem

Users coming from ADO.Net expect to use Authentication=Active Directory Default style connection strings, but the driver only supports fedauth=ActiveDirectoryDefault.

Fix

1. Connection string synonym

Added "authentication" as a synonym for "fedauth" in the ADO-style connection string parser (msdsn/conn_str.go).

2. ADO.Net-style value names

Added support for spaced authentication values in the azuread package, matching ADO.Net SqlClient names:

ADO.Net Value Maps To
Sql Password Standard SQL auth (no fedauth)
Active Directory Password ActiveDirectoryPassword
Active Directory Integrated ActiveDirectoryIntegrated
Active Directory Interactive ActiveDirectoryInteractive
Active Directory Service Principal ActiveDirectoryServicePrincipal
Active Directory Device Code Flow ActiveDirectoryDeviceCode
Active Directory Managed Identity ActiveDirectoryManagedIdentity
Active Directory MSI ActiveDirectoryMSI
Active Directory Default ActiveDirectoryDefault
Active Directory Workload Identity ActiveDirectoryWorkloadIdentity

Examples

These connection strings are now equivalent:

fedauth=ActiveDirectoryDefault
Authentication=ActiveDirectoryDefault
Authentication=Active Directory Default

Tests

Added 4 test cases to TestValidateParameters:

  • Authentication synonym with existing value name
  • Active Directory Password spaced name
  • Active Directory Managed Identity spaced name
  • Sql Password returns no fedauth config

All existing tests pass.

Fixes #288

@dlevy-msft-sql David Levy (dlevy-msft-sql) added this to the v1.11.0 milestone Apr 17, 2026
@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Apr 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.18%. Comparing base (1f52296) to head (b62385e).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main     #368       +/-   ##
===========================================
+ Coverage   77.91%   97.18%   +19.27%     
===========================================
  Files          35       93       +58     
  Lines        7222    74691    +67469     
===========================================
+ Hits         5627    72592    +66965     
- Misses       1332     2062      +730     
+ Partials      263       37      -226     
Flag Coverage Δ
unittests 97.15% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
azuread/configuration.go 57.40% <100.00%> (ø)
msdsn/conn_str.go 93.41% <ø> (ø)

... and 72 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds ADO.Net-compatible authentication naming to the Go MSSQL driver’s connection-string handling, improving migration ergonomics for users coming from Microsoft.Data.SqlClient.

Changes:

  • Add Authentication as an ADO-style keyword synonym for fedauth in msdsn parsing.
  • Normalize ADO.Net “spaced” authentication method values (e.g., Active Directory Default) to the driver’s existing ActiveDirectoryDefault-style values in azuread.
  • Extend azuread unit tests to cover the new synonym and spaced value mappings (including Sql Password meaning “no fedauth”).

Reviewed changes

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

File Description
msdsn/conn_str.go Adds authentication -> fedauth keyword synonym in ADO-style DSN parsing.
azuread/configuration.go Adds mapping table + normalization step for ADO.Net spaced Authentication values.
azuread/configuration_test.go Adds test cases validating synonym + spaced value support, including Sql Password behavior.

Comment thread msdsn/conn_str.go

Copilot AI left a comment

Copy link
Copy Markdown

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 3 out of 3 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown

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 4 out of 4 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown

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 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread azuread/configuration.go
Copilot AI review requested due to automatic review settings August 24, 2026 16:07

Copilot AI left a comment

Copy link
Copy Markdown

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 4 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

azuread/configuration.go:126

  • The ADO.Net value normalization updates the local fedAuthWorkflow variable but leaves params["fedauth"] unchanged. This means the returned config.mssqlConfig.Parameters can still contain non-canonical values like "Active Directory Default", and in the "Sql Password" case it keeps a fedauth parameter even though the function treats it as “no federated auth”. Normalizing (or deleting) the parameter in the map keeps the parsed config internally consistent and avoids passing a misleading fedauth value downstream.
	// Normalize ADO.Net-style authentication names to driver names
	if mapped, ok := adoNetAuthMap[strings.ToLower(fedAuthWorkflow)]; ok {
		if mapped == "" {
			// "Sql Password" means standard SQL auth, no federated auth
			return nil
		}
		fedAuthWorkflow = mapped
	}

Copilot AI review requested due to automatic review settings August 31, 2026 20:29

Copilot AI left a comment

Copy link
Copy Markdown

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 4 out of 4 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The change is scoped to connection string normalization, and the new behavior is covered by focused unit tests (including URL-query whitespace cases) without introducing risky protocol or API changes.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The change is narrowly scoped to connection-string parsing/normalization and is backed by targeted unit tests that cover the new synonym, all ADO.Net auth-name mappings, and whitespace edge cases.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No unresolved issues were identified, and all reviewed changes are covered by tests.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Map matches exact string constants from Microsoft.Data.SqlClient's
DbConnectionStringUtilities (e.g. 'Active Directory Password').
Only includes values defined in the ADO.NET SqlAuthenticationMethod enum.
adoNetAuthMap has ten keys and three were exercised. A typo in any of the others leaves that method unmapped and the user gets 'Invalid federated authentication type', so assert all ten against SqlAuthenticationMethod plus casing variants.
msdsn trims semicolon-style connection string values but leaves URL query
values as written, so a URL DSN could deliver a padded authentication name
to the lookup and have a valid value rejected.

Trimming here rather than in msdsn is deliberate: blanket-trimming URL query
values would also change password and similar parameters, where surrounding
whitespace is significant.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No unresolved blocking issues were identified.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 11, 2026 06:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The changes span parser and authentication mapping behavior across four files and warrant final human review.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add more ADO.Net synonyms to connection string parameters

3 participants