---
title: Set up authorization for the Databricks IDE extension
description: Learn how to set up authorization and authentication between the Databricks extension for Visual Studio Code and your Databricks workspace.
canonical_url: https://docs.databricks.com/aws/en/dev-tools/vscode-ext/authentication
---

# Set up authorization for the Databricks IDE extension

This article describes how to set up authorization and authentication between the Databricks IDE extension and your Databricks workspace if you haven't already configured the extension through project setup. See [Databricks IDE extension](https://docs.databricks.com/aws/en/dev-tools/vscode-ext/index.md).

The Databricks IDE extension implements portions of the [Databricks unified authentication](https://docs.databricks.com/aws/en/dev-tools/auth/unified-auth.md) standard, which enables you to configure Databricks OAuth 2.0-based authorization once and then use that configuration across multiple Databricks tools and SDKs without further authorization and authentication configuration changes. It also provides automatic refreshes of active access tokens, reducing your process complexity when developing.

Databricks recommends [OAuth interactive user authorization](https://docs.databricks.com/aws/en/dev-tools/auth/oauth-u2m.md), which is easy to configure using the Databricks IDE extension. See [Set up OAuth authorization and authentication](https://docs.databricks.com/aws/en/dev-tools/vscode-ext/authentication.md#oauth-u2m).

Otherwise if you are using [Authenticate with Databricks personal access tokens (legacy)](https://docs.databricks.com/aws/en/dev-tools/auth/pat.md) or [Authorize Databricks service principal access to Databricks with OAuth](https://docs.databricks.com/aws/en/dev-tools/auth/oauth-m2m.md), see [Set up authentication with a configuration profile](https://docs.databricks.com/aws/en/dev-tools/vscode-ext/authentication.md#auth-profile).

## <a id="oauth-u2m" />Set up OAuth authorization and authentication

Databricks supports OAuth 2.0-based authorization and authentication, and simplifies access token management with [Databricks unified authentication](https://docs.databricks.com/aws/en/dev-tools/auth/unified-auth.md). For more details on user and service principal authorization with Databricks, see [Authorize access to Databricks resources](https://docs.databricks.com/aws/en/dev-tools/auth/index.md).

To complete the setup for OAuth authorization, open your VSCode project with the Databricks IDE extension enabled:

1. In the **Configuration** view, click **Auth Type**, and then click the gear (**Sign in to Databricks workspace**) icon.

   ![Sign in to Databricks workspace](https://docs.databricks.com/aws/en/images/vscode-ext/sign-in-to-databricks-workspace.png)

2. If you already have an authentication [configuration profile](https://docs.databricks.com/aws/en/dev-tools/auth/config-profiles.md) in this list that has the **Authenticate using OAuth (User to Machine)** label and that you know corresponds to the target Databricks host, select it from the list, and then do the following:
   1. If prompted, complete any on-screen instructions in your web browser to finish authenticating with Databricks.
   2. If also prompted, allow **all-apis** access.
   3. Skip ahead to [Select compute for running code and jobs](https://docs.databricks.com/aws/en/dev-tools/vscode-ext/configure.md#cluster).

3. In the **Command Palette**, for **Select authentication method**, click **OAuth (user to machine)**.

4. For **Select authentication method**, select **OAuth (user to machine)**.

5. Enter some name for the associated Databricks authentication profile.

6. In the **Configuration** view, click **Login to Databricks**.

   ![Login to Databricks](https://docs.databricks.com/aws/en/images/vscode-ext/login-to-databricks.png)

7. In the **Command Palette**, for **Select authentication method**, select the name of the authentication configuration profile that you just created.

8. If prompted, complete any on-screen instructions in your web browser to finish authenticating with Databricks. If also prompted, allow **all-apis** access.

9. After you have successfully logged in, return to Visual Studio Code.

## <a id="auth-profile" />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. To create a profile, see [Databricks configuration profiles](https://docs.databricks.com/aws/en/dev-tools/auth/config-profiles.md). To configure settings for the profile, see the **Profile** tab or section for your authentication type in [Authorize access to Databricks resources](https://docs.databricks.com/aws/en/dev-tools/auth/index.md).

To select the configuration profile that you want the extension to use, with your project and the extension open, do the following:

1. In the **Configuration** view, click **Auth Type**, and then click the gear (**Sign in to Databricks workspace**) icon.

   ![Sign in to Databricks workspace](https://docs.databricks.com/aws/en/images/vscode-ext/sign-in-to-databricks-workspace.png)

2. In the **Command Palette**, select your target Databricks configuration profile in the list.

   > [!TIP]
   >
   > The target workspace host can be changed later by modifying the target `workspace` setting in the `databricks.yml` configuration file associated with the project. See [targets](https://docs.databricks.com/aws/en/dev-tools/bundles/reference.md#targets).

If you do not have a configuration profile, you can create one that authenticates by using a Databricks personal access token for example, as follows:

1. With your project and the extension open, in the **Configuration** view, click **Auth Type** or **Login to Databricks**, and then click the gear (**Sign in to Databricks workspace**) icon.

   ![Sign in to Databricks workspace](https://docs.databricks.com/aws/en/images/vscode-ext/sign-in-to-databricks-workspace.png)

2. In the **Command Palette**, select **Personal Access Token**.

3. Complete the on-screen prompts to do the following:
   1. Enter some name for the associated Databricks authentication profile.
   2. Generate the personal access token in your Databricks workspace and then copy the token's value.
   3. Return to the extension and enter the copied token's value.

The extension creates a folder in your project named `.databricks` with a file named `databricks.env`, if it does not already exist. This file contains the workspace host that you entered, along with other Databricks configuration details used by the Databricks IDE extension.

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.
