How to add Service Principal in Azure Databricks?

Balarangareddy Seelam 0 Reputation points
2023-02-15T11:16:41.3566667+00:00

I have to create a cluster in azure databricks workspace using automation scripts so that to access the databricks using azure AD access token (generated ad access token using curl command) from azure devops, i have to add a Service Principal in Azure Databricks to acces the databricks cli api's.

Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
2,514 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Leandro Ezequiel Molinari 251 Reputation points
    2023-02-23T07:13:15.5866667+00:00

    Hi Balarangareddy, good day.

    I put below, a CLI command that could work to give access to SPN to the Databricks workspace

    you need to install Databricks extension to run the command "az databricks workspace show"

    workspaceId=$(az databricks workspace show --name <workspace_name> --query id -o tsv)

    az role assignment create --role <role_name> --assignee-object-id <spn_id> --scope $workspaceId

    Have a great day.


  2. PRADEEPCHEEKATLA 90,641 Reputation points Moderator
    2023-02-23T09:23:11.1633333+00:00

    @Balarangareddy Seelam Thanks for the question and using MS Q&A platform.
    Could you please confirm if you are able to successfully added the Azure AD Service principal?

    Kindly check and retrieve a list of all service principals in the Azure Databricks
    workspace by running this command:

    GET https://<databricks-instance>/api/2.0/preview/scim/v2/ServicePrincipals

    User's image

    As per the repro, I was able to see the Azure AD Service principal successfuly available in Databricks portal.

    Add service principals to your account using SCIM API 2.0 (ServicePrincipals) for workspaces.

    Step1: You can use tools such as curl and Postman to add the Azure AD service principal to your Azure Databricks workspace.

    User's image

    Step2: Now you can see the Azure AD Service principle add to your Azure Databricks workspace.

    User's image

    Add service principals to your account using the account console

    To add a service principal to the account using the account console:

    1. As an account admin, log in to the account console.
    2. Click Account Console user management icon User management.
    3. On the Service principals tab, click Add service principal.
    4. Enter a name for the service principal.
    5. Under UUID, paste the Application (client) ID for the service principal.
    6. Click Add.

    User's image

    For more details, refer to Service principals for Azure Databricks automation and Manage service principals.
    Hope this helps. Do let us know if you any further queries.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.