Fix flat file import with Entra authentication (#21442)#21513
Conversation
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>
There was a problem hiding this comment.
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
stripEntraAuthPropertiesFromConnectionStringutility 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.
PR Changes
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ 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
🚀 New features to boost your workflow:
|
|
@laurenastrid1 could you please take a look at this PR when you have a moment? Thanks! |
|
Thanks for fixing this bug! |
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>
) 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>
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.