Describe the bug
When I try to connect to a database using Service Principal Authentication I get the following error:
ConnectionStringParseError
Connection string parsing failed: Unknown keyword 'tenant id' is not recognized
See the console area for a traceback.
Exception message: Unknown keyword 'authority id' is not recognized
Stack trace: Traceback (most recent call last):
File "/tmp/marimo_46222/__marimo__cell_bkHC_.py", line 13, in <module>
conn = mssql_python.connect(connection_string)
File "/home/kesselba/programming/test/.venv/lib/python3.13/site-packages/mssql_python/db_connection.py", line 55, in connect
conn = Connection(
connection_str,
...<4 lines>...
**kwargs,
)
File "/home/kesselba/programming/test/.venv/lib/python3.13/site-packages/mssql_python/connection.py", line 253, in __init__
self.connection_str = self._construct_connection_string(connection_str, **kwargs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kesselba/programming/test/.venv/lib/python3.13/site-packages/mssql_python/connection.py", line 376, in _construct_connection_string
parsed_params = parser._parse(connection_str)
File "/home/kesselba/programming/test/.venv/lib/python3.13/site-packages/mssql_python/connection_string_parser.py", line 273, in _parse
raise ConnectionStringParseError(errors)
mssql_python.exceptions.ConnectionStringParseError: Connection string parsing failed:
Unknown keyword 'authority id' is not recognized
To reproduce
import mssql_python
connection_string = """
Server=redacted.database.windows.net;
Database=database-name;
Authentication=ActiveDirectoryServicePrincipal;
UID=client-id;
PWD=client-secret;
Authority Id=tentant-id;
Encrypt=yes;
"""
conn = mssql_python.connect(connection_string)
Expected behavior
A working connection to the database.
Further technical details
Python version: 3.13.4
SQL Server version: Azure SQL Database
Operating system: Azure
Additional context
No additional context.
Describe the bug
When I try to connect to a database using Service Principal Authentication I get the following error:
ConnectionStringParseError
Connection string parsing failed: Unknown keyword 'tenant id' is not recognized
See the console area for a traceback.
To reproduce
Expected behavior
A working connection to the database.
Further technical details
Python version: 3.13.4
SQL Server version: Azure SQL Database
Operating system: Azure
Additional context
No additional context.