diff --git a/src/pytds/__init__.py b/src/pytds/__init__.py index 45d6c0b..ef72a3f 100644 --- a/src/pytds/__init__.py +++ b/src/pytds/__init__.py @@ -1290,7 +1290,8 @@ def connect(dsn=None, database=None, user=None, password=None, timeout=None, parsed_servers.append((host, port, instance)) if use_sso: - spn = "MSSQLSvc@{}:{}".format(parsed_servers[0][0], parsed_servers[0][1]) + server = socket.getfqdn(parsed_servers[0][0]) + spn = "MSSQLSvc@{}:{}".format(server, parsed_servers[0][1] or parsed_servers[0][2]) from . import login as pytds_login try: login.auth = pytds_login.SspiAuth(spn=spn)