question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot Authenticate with CLI

See original GitHub issue

I am trying to use the SQL Server adapter with the CLI authentication. My config is the following :

dbt version: 0.18.1
dbt-mssql version: 0.18.1
python version: 3.7.4
os info: Windows-10-10.0.19041-SP0

Here is my profiles.yml

my_profile:
  target: dev
  outputs:
    dev:
      type: sqlserver
      driver: 'ODBC Driver 17 for SQL Server'
      server: ip_of_my_server
      port: port_of_my_server
      database: db_of_my_server_that_is_not_master
      schema: my_schema
      authentication: CLI

I run az login sucessfully

You have logged in. Now let us find all the subscriptions to which you have access...

But when I run dbt debug I encounter the following error :

Connection:
  database: my_db
  schema: my_schema
  port: 1433
  UID: None
  client_id: None
  authentication: CLI
  encrypt: False
  trust_cert: False
  Connection test: ERROR

dbt was unable to connect to the specified database.
The database returned the following error:

  >Database Error
  ('28000', "[28000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Login failed for user '<token-identified principal>'. (18456) (SQLDriverConnect); [28000] [Microsoft][ODBC Driver 17 for SQL 
Server][SQL Server]Login failed for user '<token-identified principal>'. (18456)")

If I use :

authentication: ActiveDirectoryInteractive
user: me@github.com

It works but I have to authenticate at every command executed which is not efficient. Do you have any idea of what I could be doing wrong ? Or how we can fix this ?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

1reaction
EatZeBabycommented, Jan 13, 2021

I actually just made it work by running az logout and az login. I tried to reproduce the issue but couldn’t. Sorry for the false alert. Hope it might help someone one day !

Thanks a lot for your time and help @swanderz

1reaction
dataderscommented, Jan 13, 2021

@EatZeBaby thanksX1000 for the time to write up this issue. I have none of the normally-required follow up questions.

@mikaelene and @NandanHegde15 are the SQL Server Server experts here, but I’ll take a stab at this…

What version of SQL Server do you have? Where is it hosted? How is it connected to Azure?

I’m am by no means an expert, but my understanding is that you can only use the Azure CLI if your SQL Server db is associated with the Azure tenant. The two ways that I think this can be done is either by:

  • Using SQL Server Managed Instance – a pseudo-platform-as-a-service Azure offering; or
  • Using Active Directory Federation Services (ADFS) to link your Azure Active Directory to an on-premise (“classic”) Active Directory
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot authenticate using CLI even with correct credentials
I try to push my repo using the command line. A window pops up and asks for my login info, I enter it...
Read more >
GitHub Error: Authentication Failed from the Command Line
Command line authentication requires a personal access token. Go to Settings: Then Developer Settings:.
Read more >
Why can't I connect or authenticate with the Heroku Command ...
Verify that you're on the latest version of the Heroku Command Line by running heroku update . · Enable debugging during login. Make...
Read more >
Unable to Authenticate With OpenStack CLI - Platform9
Cause. Special characters in the OS_PASSWORD environment variable set using the instruction available in the Platform9 document, Installing OpenStack CLI ...
Read more >
Cannot authenticate to kubectl using the CLI on Windows - IBM
Run the C:\Users\<your_account>\. cloudctl\clusters\mycluster\kube-config. bat file. You can run kubectl commands against your cluster.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found