emacs-lsp / lsp-mssql

lsp-mode :heart: MSSQL Server
https://emacs-lsp.github.io/lsp-mssql
MIT License
34 stars 7 forks source link

Authentication with Entra ID? #24

Open tsoernes opened 3 weeks ago

tsoernes commented 3 weeks ago

Is it possible to connect to a database and authenticate with Microsoft Entra ID?

Fuco1 commented 2 weeks ago

I wrote a small function for myself to do that. I would guess you can also use other types of logins, change AUTHENTICATION appropriately.

(defun my-lsp-mssql-connect ()
      (interactive)
      (lsp)
      (lsp-mssql-connect
       (list
        :server (swb--get-default-host)
        :connectionString
        (format "SERVER=%s;DATABASE=%s;UID=%s;PWD=%s;AUTHENTICATION=ActiveDirectoryServicePrincipal"
               ;;; somehow fill these values in, `swb` is my own personal internal functions to get credentials.
                (swb--get-default-host)
                (swb--get-default-database)
                (swb--get-default-user)
                (swb--get-default-password)))))