Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
You can use either the Azure Databricks account console or the Databricks CLI to create a service principal authorized to access your workspace’s Git folders.
To create a new service principal, see Service principals. When you have a service principal in your workspace, you can link your Git credentials to it so it can access your workspace’s Git folders as part of your automation.
Authorize a service principal to access Git folders
To provide authorized access to your Git folders for a service principal using the Azure Databricks account console:
Log in to your Azure Databricks workspace. You must have administrator privileges to your workspace to complete these steps. If you do not have administrator privileges for your workspace, request them or contact your account administrator.
In the upper-right corner of any page, click your username, then select Settings.
Select Identity and access under Workspace admin in the left navigation pane, and then select the Manage button for Service Principals.
From the list of service principals, select the one you want to update with Git credentials. You can also create a new service principal by selecting Add service principal.
Select the Git integration tab. (If you didn’t create the service principal or haven’t been assigned the service principal manager privilege on it, it will be greyed out.) Under it, choose the Git provider for the credentials (such as GitHub), select Link Git account, and then select Link.
You can also use a Git personal access token (PAT) if you do not want to link your own Git credentials. To use a PAT instead, select Personal access token and provide the token information for the Git account to use when authenticating the service principal’s access. For more details on acquiring a PAT from a Git provider, see Configure Git credentials & connect a remote repo to Azure Databricks.
You will be prompted to select the Git user account to link. Choose the Git user account the service principal will use for access and select Continue. (If you do not see the user account you want to use, select Use a different account.)
In the next dialog, select Authorize Databricks. You will briefly see the message “Linking account…” and then the updated service principal details.
The service principal you chose will now apply the linked Git credentials when accessing your Azure Databricks workspace Git folder resources as part of your automation.
Use an API
To call any Databricks REST API from within a Databricks notebook cell, first install the Databricks SDK with %pip install databricks-sdk --upgrade
(for the latest Databricks REST APIs) and then import ApiClient
from databricks.sdk.core
.
Note
If %pip install databricks-sdk --upgrade
returns an error that "The package could not be found", then the databricks-sdk
package has not been previously installed. Re-run the command without the --upgrade
flag: %pip install databricks-sdk
.
You can also run Databricks SDK APIs from a notebook to retrieve the service principals for your workspace. Here's an example using Python and the Databricks SDK for Python.
You can also use tools such as curl
or Terraform. You cannot use the Azure Databricks user interface.
To learn more about service principals on Azure Databricks, see Service principals. For information about service principals and CI/CD, see Service principals for CI/CD. For more details on using the Databricks SDK from a notebook, read Use the Databricks SDK for Python from within a Databricks notebook.