Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

5.6 KB
Raw Blame
---
title: "Databricks service principal secret rotation"
sidebarTitle: "Databricks service principal secret"
description: "Learn how to automatically rotate Databricks Service Principal OAuth Secrets."
---

import ConfigureServicePrincipal from "/snippets/app-connections/databricks/configure-service-principal-for-rotation.mdx";
import ConnectionFormFields from "/snippets/app-connections/databricks/form-fields.mdx";

Rotate the OAuth client secret of a Databricks service principal on a schedule.

<Info>
  **Rotation Type: Dual-Phase**

  This rotation maintains two active credential sets with overlapping validity, ensuring zero-downtime during rotation cycles.
</Info>

<Note>
    This rotation needs a [Databricks app connection](/integrations/app-connections/databricks). This guide walks you through creating a project-scoped app connection.
</Note>

## Prerequisites

- A [project with secrets configured](/documentation/platform/secrets-mgmt/quick-starts/deliver-first-secret)
- Network access from Infisical to your Databricks workspace, if network restrictions apply

## Step 1: Set up in Databricks

Create a service principal Infisical can use to reach the workspace and grant it permission to reset the secrets of every service principal you want to rotate.

<ConfigureServicePrincipal />

## Step 2: Set up the rotation in Infisical

<Tip>
    To create the rotation using the API, use the [Create Databricks Service Principal Secret Rotation](/api-reference/endpoints/secret-rotations/databricks-service-principal-secret/create) endpoint.
</Tip>

<Steps>
    <Step title="Add the rotation" titleSize="h3">
        In your Secrets Management project, open the dashboard and select **Add Secret Rotation** from the actions dropdown.

        ![Secrets Management Dashboard](/images/secret-rotations-v2/generic/add-secret-rotation.png)

        Then, select the **Databricks Service Principal** rotation:

        ![Select Databricks Service Principal Secret](/images/secret-rotations-v2/databricks-service-principal-secret/databricks-service-principal-secret-option.png)
    </Step>
    <Step title="Configure the app connection" titleSize="h3">
        Create or select the Databricks app connection the rotation will use.

        <Tabs>
            <Tab title="Create a new app connection">
                Under **Databricks Connection**, select **Create Connection**, then choose **Databricks Connection**. Select the **Service Principal** method and complete the form:

                <ConnectionFormFields />

                ![Connect via Databricks service principal](/images/secret-rotations-v2/databricks-service-principal-secret/configure-connection.png)

                Then, select **Connect to Databricks**.

                <Note>
                    This creates a connection scoped to the current project. To share the connection across other projects, [create it at the organization level](/integrations/app-connections/databricks#step-2-create-the-app-connection) first, then select it here.
                </Note>
            </Tab>
            <Tab title="Use an existing connection">
                Under **Databricks Connection**, select the app connection you'd like to use.
            </Tab>
        </Tabs>
    </Step>
    <Step title="Configure the rotation" titleSize="h3">
        Set the rotation behavior.

        ![Rotation Configuration](/images/secret-rotations-v2/databricks-service-principal-secret/databricks-service-principal-secret-configuration.png)

        - **Rotation Interval**: The interval, in days, that once elapsed triggers a rotation.
        - **Rotate At**: The local time of day when rotation should occur once the interval has elapsed.
        - **Auto-Rotation Enabled**: When enabled, secrets rotate automatically once the interval elapses. Disable to rotate manually or pause rotation.

        When you're done, select **Next**.
    </Step>
    <Step title="Pick the target service principal" titleSize="h3">
        Select the Databricks service principal whose OAuth secret you want to rotate, then select **Next**.

        ![Rotation Parameters](/images/secret-rotations-v2/databricks-service-principal-secret/databricks-service-principal-secret-parameters.png)
    </Step>
    <Step title="Map the rotated values to secret names" titleSize="h3">
        Specify the secret names that the client credentials should be mapped to, then select **Next**.

        ![Rotation Secrets Mapping](/images/secret-rotations-v2/databricks-service-principal-secret/databricks-service-principal-secret-mapping.png)

        - **Client ID**: The name of the secret the service principal Client ID is written to.
        - **Client Secret**: The name of the secret the rotated OAuth Client Secret is written to.
    </Step>
    <Step title="Configure the details" titleSize="h3">
        Give the rotation a **Name** and an optional **Description**, then select **Next**. The name must be slug-friendly.

        ![Rotation Details](/images/secret-rotations-v2/databricks-service-principal-secret/databricks-service-principal-secret-details.png)
    </Step>
    <Step title="Review and create" titleSize="h3">
        Review your configuration, then select **Create Secret Rotation**.

        ![Rotation Review](/images/secret-rotations-v2/databricks-service-principal-secret/databricks-service-principal-secret-review.png)

        ![Rotation Created](/images/secret-rotations-v2/databricks-service-principal-secret/databricks-service-principal-secret-created.png)

        <Check>
            Your Databricks service principal credentials are now available through the mapped secrets. If auto-rotation is enabled, they rotate on your configured schedule.
        </Check>
    </Step>
</Steps>