mssql-cli icon indicating copy to clipboard operation
mssql-cli copied to clipboard

mssql-cli unable to login with domain authentication

Open mokadar opened this issue 5 years ago • 9 comments

mokadar avatar Apr 23 '20 08:04 mokadar

Did you specify the -E option when starting mssql-cli? If so, some more details would help. Could you specify mssql-cli version, error text, python version, and OS platform/distribution?

pensivebrian avatar May 14 '20 21:05 pensivebrian

I have the same issue, i am trying to use domain auth but on a mac. Is it possible?

pratio avatar Nov 03 '20 09:11 pratio

Did you specify the -E option when starting mssql-cli? If so, some more details would help. Could you specify mssql-cli version, error text, python version, and OS platform/distribution?

It looks as if the -E option would be to use the integrated authentication from the client machine. I believe the issue here is with an Sql Server which is authenticating users against the domain. This is certainly the case which I am experiencing.

SQL Server 2016 authenticating against a domain running AD 2016.

The client machine is MacOS Catalina, mssql-cli v1.0.0 running under a Python 3.8.2 interpreter.

In our case with have a server (let's call it sql-server-01.domain.com) hosting a database called MY-DB, which is authenticating its users against the domain DOMAIN.

mssql-cli -S sql-server-01.domain.com -d MY-DB -U DOMAIN/user -P *****
Error message: Login failed for user 'DOMAIN/user'.

I can verify that the configuration is correct from the server side using pymssql:

import pymssql

pymssql.connect(
  server='sql-server-01.domain.com',
  user='DOMAIN/user',
  password='*****',
  database='MY_DB'
)

iainworkman avatar Dec 02 '20 22:12 iainworkman

any news regarding this issue? this is the exception I receive with the --enable-sqltoolsservice-logging option:

   at Microsoft.SqlTools.Utility.Logger.Close() in D:\a\1\s\src\Microsoft.SqlTools.Hosting\Utility\Logger.cs:line 79
   at Microsoft.SqlTools.ServiceLayer.Program.Main(String[] args) in D:\a\1\s\src\Microsoft.SqlTools.ServiceLayer\Program.cs:line 27
Traceback (most recent call last):
  File "/home/kali/.local/lib/python3.9/site-packages/mssqlcli/jsonrpc/contracts/request.py", line 51, in get_response
    response = self.json_rpc_client.get_response(self.request_id, self.owner_uri)
  File "/home/kali/.local/lib/python3.9/site-packages/mssqlcli/jsonrpc/jsonrpcclient.py", line 84, in get_response
    raise self.exception_queue.get()
  File "/home/kali/.local/lib/python3.9/site-packages/mssqlcli/jsonrpc/jsonrpcclient.py", line 124, in _listen_for_response
    response = self.reader.read_response()
  File "/home/kali/.local/lib/python3.9/site-packages/mssqlcli/jsonrpc/jsonrpcclient.py", line 272, in read_response
    while (not self.needs_more_data or self.read_next_chunk()):
  File "/home/kali/.local/lib/python3.9/site-packages/mssqlcli/jsonrpc/jsonrpcclient.py", line 326, in read_next_chunk
    raise EOFError(u'End of stream reached, no output.')
EOFError: End of stream reached, no output.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/kali/.local/lib/python3.9/site-packages/mssqlcli/main.py", line 122, in <module>
    main()
  File "/home/kali/.local/lib/python3.9/site-packages/mssqlcli/main.py", line 115, in main
    run_cli_with(mssqlcli_options)
  File "/home/kali/.local/lib/python3.9/site-packages/mssqlcli/main.py", line 52, in run_cli_with
    mssqlcli.connect_to_database()
  File "/home/kali/.local/lib/python3.9/site-packages/mssqlcli/mssql_cli.py", line 278, in connect_to_database
    owner_uri, error_messages = self.mssqlcliclient_main.connect_to_database()
  File "/home/kali/.local/lib/python3.9/site-packages/mssqlcli/mssqlcliclient.py", line 91, in connect_to_database
    owner_uri, error_messages = self._execute_connection_request_with(connection_params)
  File "/home/kali/.local/lib/python3.9/site-packages/mssqlcli/mssqlcliclient.py", line 180, in _execute_connection_request_with
    response = connection_request.get_response()
  File "/home/kali/.local/lib/python3.9/site-packages/mssqlcli/jsonrpc/contracts/request.py", line 67, in get_response
    return self.response_error(error)
  File "/home/kali/.local/lib/python3.9/site-packages/mssqlcli/jsonrpc/contracts/connectionservice.py", line 22, in response_error
    u'ownerUri': cls.owner_uri,
AttributeError: type object 'ConnectionRequest' has no attribute 'owner_uri'

onionpsy avatar Jul 30 '21 00:07 onionpsy

@iainworkman I am able to login with a domain account from a windows client machine. (i used backslash) give it a try.

mssql-cli -S SQLINSTANCENAME -d MY-DB -U DOMAIN\user -P ***** -E

azinsharaf avatar Sep 08 '21 00:09 azinsharaf

I am using a Windows box and I get the following error image

csolje avatar Dec 15 '21 11:12 csolje

@csolje this is a different error. as far as i know python3.10 is not supported. I am using 3.9.11 on Win and mssql-cli works.

azinsharaf avatar Jan 27 '23 22:01 azinsharaf

@azinsharaf I will try that out

csolje avatar Feb 26 '23 14:02 csolje

@azinsharaf how are you using it in 3.9.11?

Do you have install the latest one also?

csolje avatar Mar 23 '23 12:03 csolje