Skip to content

Commit 9135dc7

Browse files
docs: add OAuth M2M authentication as recommended option for Databricks (#2169)
* docs: add OAuth M2M authentication as recommended option for Databricks Co-Authored-By: Itamar Hartstein <haritamar@gmail.com> * databricks docs - oauth m2m screenshots + fixes --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Itamar Hartstein <haritamar@gmail.com>
1 parent d0d4b98 commit 9135dc7

File tree

2 files changed

+59
-10
lines changed

2 files changed

+59
-10
lines changed

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+
<img
28+
src="https://res.cloudinary.com/dgpojk42n/image/upload/v1774307890/databricks_form_oauth_m2m_v0jhp9.png"
29+
alt="Authenticate with M2M OAuth"
30+
/>
31+
32+
- **Client ID**: The Application (client) ID of the service principal (the "Application ID" you copied in [step 5](#create-service-principal)).
33+
- **Client secret**: The OAuth secret you generated for the service principal (see [step 7](#create-service-principal)).
34+
35+
<Info>
36+
OAuth machine-to-machine (M2M) authentication is the recommended method for connecting to Databricks.
37+
It uses short-lived tokens that are automatically refreshed, providing better security compared to
38+
long-lived personal access tokens.
39+
</Info>
40+
41+
#### Access token (legacy)
42+
43+
<img
44+
src="https://res.cloudinary.com/dgpojk42n/image/upload/v1774307890/databricks_form_token_dluwcr.png"
45+
alt="Authenticate with Access Token"
46+
/>
47+
48+
- **Access token**: A personal access token generated for the Elementary service principal.
49+
2450
<IpAllowlist />

docs/snippets/dwh/databricks/create_service_principal.mdx

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,38 @@ 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+
<img
43+
src="https://res.cloudinary.com/dgpojk42n/image/upload/v1774307890/databricks_m2m_oauth_1_lzix16.png"
44+
alt="Generate OAuth M2M Secret (1)"
45+
/>
46+
<img
47+
src="https://res.cloudinary.com/dgpojk42n/image/upload/v1774307890/databrick_m2m_oauth_2_yhwws8.png"
48+
alt="Generate OAuth M2M Secret (2)"
49+
/>
50+
51+
<Info>
52+
OAuth secrets are the recommended authentication method. They enable short-lived token generation
53+
with automatic refresh, providing better security than long-lived personal access tokens.
54+
</Info>
55+
56+
**Option B: Create a personal access token (legacy)**
57+
58+
In order to generate a personal access token for your service principal, you may first need to allow Token Usage for it.
59+
To do so, go to the settings menu and choose Advanced -> Personal Access Tokens -> Permission Settings, then make sure the service principal is in the list.
60+
61+
<img
62+
src="https://res.cloudinary.com/dgpojk42n/image/upload/v1763316575/databricks_06_token_usage_eufjwv.png"
63+
alt="Allow token usage for service principal"
64+
/>
4265

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)
66+
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).
4467

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.
68+
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.
4669
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)