Skip to content

Sign in to SQL Server with an access token file - #1845

Merged
jschoedl merged 4 commits into
datacontract:mainfrom
SreeramaYeshwanthGowd:feat/1830-sqlserver-token-file
Nov 24, 2026
Merged

jschoedl merged 4 commits into
datacontract:mainfrom
SreeramaYeshwanthGowd:feat/1830-sqlserver-token-file

Conversation

@SreeramaYeshwanthGowd

Copy link
Copy Markdown
Contributor

Adds a token mode for signing in to SQL Server, as discussed in #1830. With DATACONTRACT_SQLSERVER_AUTHENTICATION=token, the CLI reads an Entra ID access token from the file named in DATACONTRACT_SQLSERVER_TOKEN_FILE_PATH on every connection, and passes it to the ODBC driver the same way the cli mode does. As suggested in the issue, the new option is server-only in the API and guarded next to the SQL Server password, like the Snowflake token file.

Closes #1830

  • Tests pass (uv run pytest)
  • Code formatted (uv run ruff check --fix && uv run ruff format)
  • Docs updated (if relevant)
  • CHANGELOG.md entry added

DATACONTRACT_SQLSERVER_AUTHENTICATION=token reads an Entra ID access token from DATACONTRACT_SQLSERVER_TOKEN_FILE_PATH on every connection and passes it like the cli mode. The path is server-only in the API and guarded like the SQL Server password.

Closes datacontract#1830
With DATACONTRACT_SQLSERVER_AUTHENTICATION=token, a token file that is missing or unreadable now fails with an error naming DATACONTRACT_SQLSERVER_TOKEN_FILE_PATH and the path. An empty file fails the same way, before connecting.

@jschoedl jschoedl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you!

@jschoedl
jschoedl merged commit c702b55 into datacontract:main Nov 24, 2026
18 checks passed
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.

SQL Server: accept an access token (token file) instead of requiring the Azure CLI

2 participants