Azure Databricks

Updated at:

Configure Azure Databricks as a data source for the scanner by authorizing a service account and setting up the connection.

Service account authorization

-- 1. Create a custom role
CREATE ROLE <role>;

-- 2. Grant metadata read permissions
GRANT BROWSE ON CATALOG <catalog_name> TO ROLE <role>;
GRANT USE CATALOG ON CATALOG <catalog_name> TO ROLE <role>;
GRANT USE SCHEMA ON CATALOG <catalog_name> TO ROLE <role>;
GRANT SELECT ON CATALOG <catalog_name> TO ROLE <role>;

-- 3. Assign the role to a service principal or user
GRANT ROLE <role> TO <service_principal_application_id>;

Data Source Management

1. Basic configuration

Option

Description

--meta-type

Metadata type: UNITY_CATALOG (Required)

--host

Databricks host address (Required)

--http-path

SQL Warehouse HTTP path (Required)

To obtain the basic Databricks configuration:

  1. On the Overview page of your Databricks workspace, click Launch Workspace.

  2. In the navigation pane on the left, select SQL Warehouses.

  3. If you have not created a SQL warehouse, click Create SQL warehouse and follow the instructions to create one.

  4. In the list, click the target warehouse and then go to the Connection details tab.

  5. On this tab, copy the following:

    • The Server hostname corresponds to the host parameter in the data source configuration.

    • The HTTP path corresponds to the http-path parameter in the data source configuration.

image.png

2. PAT authentication

Option

Description

--login-type

Authentication type: pat (Required)

--token

Personal Access Token (Required)

To obtain a PAT:

  1. In your Databricks workspace, click your profile picture in the upper-right corner to go to the Settings page.

  2. In the Settings navigation pane on the left, select Developer.

  3. In the Access tokens area, click the Manage button.

  4. Click Generate new token, set the Lifetime (days), and add a comment. A Personal Access Token (PAT) is generated. Save the token value in a secure location.

image.png

lhm datasource set Databricks -n Databricks1 \
    --meta-type UNITY_CATALOG \
    --host https://adb-xxx.azuredatabricks.net \
    --http-path /sql/1.0/warehouses/xxx \
    --login-type pat \
    --token '$DATABRICKS_TOKEN'