Skip to main content
Solved

Connecting Cognite DB Extractor to Databricks via ODBC Using a Service Principal

  • July 22, 2026
  • 4 replies
  • 33 views

Andre Alves
MVP ⭐️⭐️⭐️⭐️⭐️
Forum|alt.badge.img+14

Hi Community,

Has anyone successfully configured the Cognite DB Extractor to connect to Databricks via ODBC using a service principal?

I was able to connect to Databricks using a Personal Access Token (PAT), but I am experiencing issues when trying to authenticate with a service principal.

Any guidance or examples would be greatly appreciated.

Thanks in advance,
Andre

Best answer by Michael Bennett

Hi ​@Andre Alves

 

Sorry for the delay. It appears that Service Principle ODBC authentication is not supported on the hosted extractors. I’ve done a search in the db extractor gh repo, and I don’t see any notes, PRs, etc in regards to SP support. With that said, I’ve brought this up to the extractor team to see if we can discuss supporting this. From a security standpoint, I’ve asked if it’s possible to integrate the bitwarden secret manager SDK. The bw sdk could be an option to safely inject secrets into a pyodbc driver.

 

A question and some suggestions about the SP and odbc.

  1. When you test the creds and the creds fail, does the error supply a sql state?
  2. Please make sure that your secret is enclosed in brackets in case there is a special character. 
  3. You can temporarily include TrustServerCertificate=yes in your connection string to test SSL settings.

 

One last point. I did see some Entra ID auth via ODBC to databricks settings that you may want to test. I think the M2M section would apply to this scenario. The auth_scope setting should contain the azure databricks app id, also known as “resource id”

 

So your auth_scope would look like 

 

 

Auth_Scope=******-3304-4ab8-85cb-*********/.default

Here’s a couple of links to support. https://docs.databricks.com/aws/en/integrations/odbc/authentication

https://learn.microsoft.com/en-us/azure/databricks/integrations/odbc/authentication#authentication-m2m-azure
 

Please let me know your findings to see if any workarounds helped.

 

 

4 replies

Michael Bennett
Expert ⭐️⭐️⭐️⭐️
Forum|alt.badge.img+12
  • Expert ⭐️⭐️⭐️⭐️
  • July 22, 2026

Hi Andre!

 

Thanks for reaching out. Could you provide some context on the ODBC properties you’re using and the connection string you’re using? You can scurb all sensitive info and send to me directly. 

Are you using OAuthM2M? If so, could you send me the yaml? SystemDSN could potentially be another option for auth (especially on Windows). 

 

Also, can you confirm the version of the databricks ODBC driver you’re using? 2.8.0 or greater is a requirement.

And how are you running the Cognite db extractor? Windows service or executable? Docker image? Linux process?

 

Thanks!

Michael Bennett
Academy Engineer


Andre Alves
MVP ⭐️⭐️⭐️⭐️⭐️
Forum|alt.badge.img+14
  • Author
  • MVP ⭐️⭐️⭐️⭐️⭐️
  • July 23, 2026

For testing purposes, I am using the standalone executable version of the Cognite DB Extractor. The ODBC driver is the latest version available on the Databricks website: Databricks ODBC Connector 2.12.0. The Databricks ODBC driver supports service principal (OAuth M2M) authentication using AuthMech=11 and Auth_Flow=1, which is the configuration I'm using.

My connection string looks like this:

Driver=<path-to-driver>;
Host=<server-hostname>;
Port=443;
HTTPPath=<http-path>;
SSL=1;
ThriftTransport=2;
AuthMech=11;
Auth_Flow=1;
Auth_Client_ID=<service-principal-application-ID>;
Auth_Client_Secret=<service-principal-secret>;
Auth_Scope=all-apis;

I have verified that the same connection works when using a Personal Access Token (PAT), so my main goal is to confirm whether the Cognite team has ever experienced any issues connecting to Databricks through ODBC using a service principal instead of a PAT.

Any insights or previous experience with this scenario would be greatly appreciated.


Michael Bennett
Expert ⭐️⭐️⭐️⭐️
Forum|alt.badge.img+12
  • Expert ⭐️⭐️⭐️⭐️
  • Answer
  • July 29, 2026

Hi ​@Andre Alves

 

Sorry for the delay. It appears that Service Principle ODBC authentication is not supported on the hosted extractors. I’ve done a search in the db extractor gh repo, and I don’t see any notes, PRs, etc in regards to SP support. With that said, I’ve brought this up to the extractor team to see if we can discuss supporting this. From a security standpoint, I’ve asked if it’s possible to integrate the bitwarden secret manager SDK. The bw sdk could be an option to safely inject secrets into a pyodbc driver.

 

A question and some suggestions about the SP and odbc.

  1. When you test the creds and the creds fail, does the error supply a sql state?
  2. Please make sure that your secret is enclosed in brackets in case there is a special character. 
  3. You can temporarily include TrustServerCertificate=yes in your connection string to test SSL settings.

 

One last point. I did see some Entra ID auth via ODBC to databricks settings that you may want to test. I think the M2M section would apply to this scenario. The auth_scope setting should contain the azure databricks app id, also known as “resource id”

 

So your auth_scope would look like 

 

 

Auth_Scope=******-3304-4ab8-85cb-*********/.default

Here’s a couple of links to support. https://docs.databricks.com/aws/en/integrations/odbc/authentication

https://learn.microsoft.com/en-us/azure/databricks/integrations/odbc/authentication#authentication-m2m-azure
 

Please let me know your findings to see if any workarounds helped.

 

 


Andre Alves
MVP ⭐️⭐️⭐️⭐️⭐️
Forum|alt.badge.img+14
  • Author
  • MVP ⭐️⭐️⭐️⭐️⭐️
  • July 30, 2026

Thanks, @Michael Bennett 

I really appreciate your help with this.

Cheers!