Skip to content

Fix flat file import with Entra authentication (#21442)#21513

Merged
kburtram merged 1 commit into
mainfrom
fix/issue-21442
Mar 9, 2026
Merged

Fix flat file import with Entra authentication (#21442)#21513
kburtram merged 1 commit into
mainfrom
fix/issue-21442

Conversation

@kburtram
Copy link
Copy Markdown
Member

@kburtram kburtram commented Mar 6, 2026

Fixes #21442. When using Entra auth, the connection string contains User ID and Authentication properties that conflict with setting AccessToken on SqlConnection. Strip conflicting auth properties from the connection string and refresh the token before sending the import request.

When using Entra auth, the connection string contains User ID and
Authentication properties that conflict with setting AccessToken on
SqlConnection. Strip conflicting auth properties from the connection
string and refresh the token before sending the import request.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes flat file import failures for Microsoft Entra (Azure MFA) connections by ensuring a valid access token is used and by sanitizing the connection string so it’s compatible with setting AccessToken in SqlClient.

Changes:

  • Added stripEntraAuthPropertiesFromConnectionString utility to remove auth keywords that conflict with access-token usage.
  • Updated flat file import flow to refresh Entra token when needed and send a sanitized connection string to the flat file service.
  • Added unit tests covering the new connection-string sanitization helper.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
extensions/mssql/src/controllers/flatFileImportWebviewController.ts Refreshes Entra token for Azure MFA and sends a sanitized connection string for import.
extensions/mssql/src/flatFile/flatFileUtils.ts Introduces helper to strip conflicting auth properties from connection strings.
extensions/mssql/test/unit/flatFileUtils.test.ts Adds unit tests for the new connection-string sanitization behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread extensions/mssql/src/controllers/flatFileImportWebviewController.ts
Comment thread extensions/mssql/src/flatFile/flatFileUtils.ts
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 6, 2026

PR Changes

Category Target Branch PR Branch Difference
vscode-mssql VSIX 6402 KB 6403 KB ⚪ 1 KB ( 0% )
sql-database-projects VSIX 7060 KB 7060 KB ⚪ 0 KB ( 0% )
data-workspace VSIX 535 KB 535 KB ⚪ 0 KB ( 0% )

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 7, 2026

Codecov Report

❌ Patch coverage is 81.25000% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.54%. Comparing base (e86d4f9) to head (5ec565b).
⚠️ Report is 49 commits behind head on main.

Files with missing lines Patch % Lines
...src/controllers/flatFileImportWebviewController.ts 52.63% 9 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #21513   +/-   ##
=======================================
  Coverage   72.53%   72.54%           
=======================================
  Files         330      331    +1     
  Lines       98198    98243   +45     
  Branches     5433     5439    +6     
=======================================
+ Hits        71231    71267   +36     
- Misses      26967    26976    +9     
Files with missing lines Coverage Δ
extensions/mssql/src/flatFile/flatFileUtils.ts 100.00% <100.00%> (ø)
...src/controllers/flatFileImportWebviewController.ts 91.44% <52.63%> (-1.61%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kburtram
Copy link
Copy Markdown
Member Author

kburtram commented Mar 9, 2026

@laurenastrid1 could you please take a look at this PR when you have a moment? Thanks!

@laurenastrid1
Copy link
Copy Markdown
Contributor

Thanks for fixing this bug!

@kburtram kburtram merged commit af166c8 into main Mar 9, 2026
7 checks passed
@kburtram kburtram deleted the fix/issue-21442 branch March 9, 2026 18:30
kburtram added a commit that referenced this pull request Mar 9, 2026
When using Entra auth, the connection string contains User ID and
Authentication properties that conflict with setting AccessToken on
SqlConnection. Strip conflicting auth properties from the connection
string and refresh the token before sending the import request.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
kburtram added a commit that referenced this pull request Mar 10, 2026
)

When using Entra auth, the connection string contains User ID and
Authentication properties that conflict with setting AccessToken on
SqlConnection. Strip conflicting auth properties from the connection
string and refresh the token before sending the import request.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

[Bug]: Can't use flat file import with Entra authentication

4 participants