Skip to main content

Authorize a service principal to access Git folders

A service principal is a non-human identity that automates tasks in Databricks, including accessing and interacting with Git folders. This page explains how to authorize a service principal to use Git credentials for Git folder operations.

To link Git credentials to a service principal:

  1. As a workspace admin, log in to the Databricks workspace.

  2. Click your username in the top bar and select Settings.

  3. Click the Identity and access tab.

  4. Next to Service principals, click Manage.

  5. Select the service principal that you want to update with Git credentials.

  6. Click the Git integration tab.

  7. Click Add Git credential.

  8. Choose the Git provider from the dropdown menu and click Link.

    To use a personal access token instead of linking your own Git credentials, select Personal access token and provide the token information. See Configure Git credentials & connect a remote repo to Databricks.

  9. Select the Git user account that the service principal uses for access.

  10. Click Continue.

  11. Click Authorize Databricks.

The service principal now uses the linked Git credentials when accessing your Databricks workspace Git folder resources as part of your automation.

Retrieve service principals programmatically

Retrieve service principals for your workspace using the Databricks SDK, REST APIs, or CLI.

To use the Databricks SDK from a notebook:

  1. Install the Databricks SDK: %pip install databricks-sdk --upgrade
  2. Import ApiClient from databricks.sdk.core.
  3. Call the service principals API.

For code examples, see the Databricks SDK for Python documentation.

You can also use curl, the Databricks CLI, or Terraform to work with service principals programmatically.

What's next