Skip to content

Commit 79678e3

Browse files
docs: add OAuth M2M authentication as recommended option for Databricks
Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
1 parent d0d4b98 commit 79678e3

2 files changed

Lines changed: 51 additions & 10 deletions

File tree

docs/snippets/cloud/integrations/databricks.mdx

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,38 @@ This guide contains the necessary steps to connect a Databricks environment to y
1313
In the Elementary platform, go to Environments in the left menu, and click on the "Create Environment" button.
1414
Choose a name for your environment, and then choose Databricks as your data warehouse type.
1515

16-
Provide the following fields in the form:
16+
Provide the following common fields in the form:
1717

1818
- **Server Host**: The hostname of your Databricks account to connect to.
1919
- **Http path**: The path to the Databricks cluster or SQL warehouse.
20-
- **Access token**: The token you generated for the Elementary service principal (see step 7 under "Create service principal" above)
2120
- **Catalog (optional)**: The name of the Databricks Catalog.
2221
- **Elementary schema**: The name of your Elementary schema. Usually `[your dbt target schema]_elementary`.
2322

23+
Then, select your authentication method:
24+
25+
#### OAuth (M2M) — Recommended
26+
27+
{/* TODO: Add screenshot of the Elementary environment form with OAuth (M2M) selected */}
28+
29+
- **Client ID**: The Application (client) ID of the service principal (the "Application ID" you copied in [step 5](#create-service-principal)).
30+
- **Client secret**: The OAuth secret you generated for the service principal (see [step 7](#create-service-principal)).
31+
32+
<Info>
33+
OAuth machine-to-machine (M2M) authentication is the recommended method for connecting to Databricks.
34+
It uses short-lived tokens that are automatically refreshed, providing better security compared to
35+
long-lived personal access tokens.
36+
</Info>
37+
38+
#### Access token (legacy)
39+
40+
{/* TODO: Add screenshot of the Elementary environment form with Access token (legacy) selected */}
41+
42+
- **Access token**: A personal access token generated for the Elementary service principal.
43+
44+
<Warning>
45+
Personal access tokens are considered legacy authentication. We recommend using OAuth (M2M) instead
46+
for improved security and automatic token rotation. If you are currently using a personal access token,
47+
consider migrating to OAuth (M2M).
48+
</Warning>
49+
2450
<IpAllowlist />

docs/snippets/dwh/databricks/create_service_principal.mdx

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,30 @@ to access your Databricks instance.
3232
alt="Add databricks SQL access"
3333
/>
3434

35-
6. Next, you may also need to allow Token Usage for this service principal (if it is not allowed for all users). To do so, under the settings menu choose Advanced -> Personal Access Tokens -> Permission Settings.
36-
Then add the service principal there.
35+
6. Next, generate credentials for your service principal. Choose one of the following methods:
3736

38-
<img
39-
src="https://res.cloudinary.com/dgpojk42n/image/upload/v1763316575/databricks_06_token_usage_eufjwv.png"
40-
alt="Add databricks SQL access"
41-
/>
37+
**Option A: Generate an OAuth secret (Recommended)**
38+
39+
On the service principal page, go to the *Secrets* tab and click *Generate secret*. Copy the **Client ID** (this is the same as the "Application ID" from step 5) and the generated **Client secret** — you will need both when configuring the Elementary environment.
40+
41+
{/* TODO: Add screenshot of Databricks service principal Secrets tab with "Generate secret" button */}
42+
43+
<Info>
44+
OAuth secrets are the recommended authentication method. They enable short-lived token generation
45+
with automatic refresh, providing better security than long-lived personal access tokens.
46+
</Info>
47+
48+
**Option B: Create a personal access token (legacy)**
49+
50+
You may also need to allow Token Usage for this service principal (if it is not allowed for all users). To do so, under the settings menu choose Advanced -> Personal Access Tokens -> Permission Settings.
51+
Then add the service principal there.
52+
53+
<img
54+
src="https://res.cloudinary.com/dgpojk42n/image/upload/v1763316575/databricks_06_token_usage_eufjwv.png"
55+
alt="Allow token usage for service principal"
56+
/>
4257

43-
7. Create a personal access token for your service principal. For more details, please click [here](https://docs.databricks.com/aws/en/dev-tools/auth/pat#databricks-personal-access-tokens-for-service-principals)
58+
Then, create a personal access token for your service principal. For more details, please click [here](https://docs.databricks.com/aws/en/dev-tools/auth/pat#databricks-personal-access-tokens-for-service-principals).
4459

45-
8. Finally, in order to enable Elementary's automated monitors feature, please ensure [predictive optimization](https://docs.databricks.com/aws/en/optimizations/predictive-optimization#enable-or-disable-predictive-optimization-for-your-account) is enabled in your account.
60+
7. Finally, in order to enable Elementary's automated monitors feature, please ensure [predictive optimization](https://docs.databricks.com/aws/en/optimizations/predictive-optimization#enable-or-disable-predictive-optimization-for-your-account) is enabled in your account.
4661
This is required for table statistics to be updated (Elementary relies on this to obtain up-to-date row counts)

0 commit comments

Comments
 (0)