cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

databricks single user cluster is not able to assign service principals

17780
New Contributor II

I want to set the databricks cluster Access mode to single user and assign the service principal account to the user.

In other words, after creating a single mode cluster, how can I access only servcie principals?

5 REPLIES 5

17780
New Contributor II

Cluster Type is All-purpose Compute

AFox
Contributor

@17780 Did you ever figure this out?  I am trying to do the same.

Zpakerman
New Contributor II

Sure thing! So, if you're looking to set up your data block cluster access mode to a single user and want that user to be a service principal account, you've got a couple of steps ahead. First, create your single-mode cluster. Once that's done, you'll need to assign the service principal account to it. This involves configuring the necessary permissions and access rights for that service principal. After the setup, you should be able to access the cluster using only the service principal account you've designated. It's all about fine-tuning those permissions to ensure that only the right folks (or, in this case, service principals) can get in. Double-check your configurations, and you should be good to go!

Best regards, Zpakerman

SathyaVasu
New Contributor II

Below solution worked for me!!
It is not possible to update single user via UI
But you can update the service principal as the signle user via databricks cli.
1. install databricks cli

2. run command databricks configure

3. run command:
# Execute clusters edit Command to Set Service Principal as Single User
databricks clusters edit <cluster id> <spark version number>--cluster-name "<cluster name>" --data-security-mode SINGLE_USER --single-user-name <client id of the service principal> --num-workers 1 --node-type-id <node type> --no-wait

Pat_IronBridges
New Contributor II

So, here is an alternative to either the UI (doesn't work actually; not possible) or the CLI. Use the Databricks API.

endpoint_change = f"{databricksURL}/api/2.1/clusters/edit" # change single owner

payload_change = {
    "cluster_id": cluster_id
  ,"cluster_name": cluster_name
  ,"single_user_name": new_owner # serv principal user id
  ,"num_workers": 1
  ,"spark_version": "14.3.x-cpu-ml-scala2.12" # required; set to what you want
  ,"node_type_id": "r6id.xlarge" #required; set to what you want
  ,"data_security_mode": "SINGLE_USER"

}

response = requests.post(
            endpoint_change,
            headers=headers,
            json=payload_change
        )
#if you have init scripts running, they should be included in the the json payload as well.  (doesn't work setting them in the UI).
# also be sure the service principal has access to the init script location
 
 

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group