Authentication setup for the Databricks extension for Visual Studio Code
This article describes how to set up authentication between the Databricks extension for Visual Studio Code and your Databricks workspace. See What is the Databricks extension for Visual Studio Code?
The Databricks extension for Visual Studio Code implements portions of the Databricks client unified authentication standard, a consolidated and consistent architectural and programmatic approach to authentication. This approach helps make setting up and automating authentication with Databricks more centralized and predictable. It enables you to configure Databricks authentication once and then use that configuration across multiple Databricks tools and SDKs without further authentication configuration changes.
The following information assumes that you have already installed the Databricks extension for Visual Studio Code. See Install the Databricks extension for Visual Studio Code.
Depending on the type of authentication that you want to use, complete the instructions for your target Databricks authentication type.
For the following authentication types, skip ahead to Set up authentication with a configuration profile:
For OAuth user-to-machine (U2M) authentication, skip ahead to Set up OAuth U2M authentication.
Set up authentication with a configuration profile
The following instructions assume that you have already set up a Databricks configuration profile with the required fields for your Databricks authentication type. See Databricks configuration profiles and the Profile tab or section for your authentication type in Authentication for Databricks automation.
With your project and the extension opened, do the following:
In the Configuration pane, click Configure Databricks.
Note
If Configure Databricks is not visible, click the gear (Configure workspace) icon next to Configuration instead.
In the Command Palette, for Databricks Host, enter your workspace instance URL, for example
https://dbc-a1b2345c-d6e7.cloud.databricks.com
. Then press Enter.Select your target Databricks configuration profile in the list for the URL.
The extension creates a hidden folder in your project named .databricks
if it does not already exist. The extension also creates in this folder a file named project.json
if it does not already exist. This file contains the URL that you entered, along with some Databricks authentication details that the Databricks extension for Visual Studio Code needs to operate.
The extension also adds a hidden .gitignore
file to the project if the file does not exist or if an existing .gitignore
cannot be found in any parent folders. If a new .gitignore
file is created, the extension adds a .databricks/
entry to this new file. If the extension finds an existing .gitignore
file, it adds a .databricks/
entry to the existing file.
Continue with Select a cluster for the Databricks extension for Visual Studio Code.
Set up OAuth U2M authentication
Preview
This feature is in Public Preview.
Databricks on AWS supports OAuth user to machine (U2M) authentication. This enables you to generate short-lived (one hour) OAuth access tokens, which eliminates the risk of accidentally exposing longer-lived tokens such as Databricks personal access tokens through version control checkins or other means. This also enables better server-side session invalidation and scoping.
This section assumes that you have already completed the OAuth U2M authentication setup instructions in OAuth user-to-machine (U2M) authentication.
To complete the setup for OAuth M2M authentication, with your project and the extension opened, do the following:
In the Configuration pane, click Configure Databricks.
Note
If Configure Databricks is not visible, click the gear (Configure workspace) icon next to Configuration instead.
In the Command Palette, for Databricks Host, enter your workspace instance URL, for example
https://dbc-a1b2345c-d6e7.cloud.databricks.com
. Then press Enter.Select OAuth (user to machine).
Complete the on-screen instructions within your web browser to finish authenticating with your Databricks account and allowing all-apis access.
The extension creates a hidden folder in your project named .databricks
if it does not already exist. The extension also creates in this folder a file named project.json
if it does not already exist. This file contains the URL that you entered, along with some Databricks authentication details that the Databricks extension for Visual Studio Code needs to operate.
The extension also adds a hidden .gitignore
file to the project if the file does not exist or if an existing .gitignore
cannot be found in any parent folders. If a new .gitignore
file is created, the extension adds a .databricks/
entry to this new file. If the extension finds an existing .gitignore
file, it adds a .databricks/
entry to the existing file.
Continue with Select a cluster for the Databricks extension for Visual Studio Code.