dbt-sqlserver icon indicating copy to clipboard operation
dbt-sqlserver copied to clipboard

can not log into sql server using domain account

Open yxl1108 opened this issue 2 years ago • 5 comments

OS: WSL2 / Ubuntu 20.04.6 LTS (Focal Fossa) Driver: Microsoft ODBC Driver 18 for SQL Server

Installation: curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list apt-get update ACCEPT_EULA=Y apt-get install -y msodbcsql18 apt-get install -y unixodbc-dev gnupg libkrb5-dev pkg-config

dbt profile.yml: local: type: sqlserver driver: 'ODBC Driver 18 for SQL Server' server: sql-server-instance.domain.com port: 1433 trust_cert: true database: database_name schema: dbo authentication: ActiveDirectoryPassword user: 'DOMAIN\username' password: 'password' threads: 4

Error: with authentication: ActiveDirectoryPassword

Database Error ('28000', "[28000] [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Login failed for user ''. (18456) (SQLDriverConnect)")

without authentication: ActiveDirectoryPassword

Database Error ('28000', "[28000] [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Login failed for user 'DOMAIN\\username'. (18456) (SQLDriverConnect)")

Observations: sql server authentication works fine

yxl1108 avatar Jul 31 '23 12:07 yxl1108

If it can help, this is what we're using to connect with the Windows user of the current session.

dbt-transform:
  target: local
  outputs:
    local:
      type: sqlserver
      driver: 'ODBC Driver 17 for SQL Server'
      server: my_server\name
      port: 1433
      trusted_connection: True
      encrypt: False
      threads: 2
      database: my_db
      schema: my_local_schema

NicolasPA avatar Aug 07 '23 10:08 NicolasPA

I see you use trusted_connection here. doesn't this imply it's running on domain joined windows hosts? I am running dbt for sql server on ubuntu, which is not domain joined.

yxl1108 avatar Aug 14 '23 18:08 yxl1108

Yes, it's all Windows.

NicolasPA avatar Aug 17 '23 18:08 NicolasPA

@yxl1108 as far I know, you need to login with a SQL Account.

AD Accounts, can only login to a SQL Server using Trusted Connection when you had logged with the same account at your machine.

At my setup, I have a dedicated SQL Account for dbt jobs.

romiof avatar Feb 02 '24 12:02 romiof