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:ย 

Automation creation of Databricks Top Level Repositories

alefred
New Contributor II

I'm looking to automate the creation of Top Level repositories in Databricks however isn't possible using cli or API if this repo is private repository(Azure DevOps Repository) because require setup the token in user setting.

databricks repos create \
   --url https://<orgname>:<PAT_token>@dev.azure.com/<orgname>/<projectname>/_git/<reponame>; \
  --provider azureDevOpsServices \
  --path /Repos/Repository/<reponame> \
  --debug

That's a problem because use a git command like git clone with the same structure works without problems.

git clone https://<orgname>:<PAT_token>@dev.azure.com/<orgname>/<projectname>/_git/<reponame>;

Someone with any idea to solve this challenge?

1 ACCEPTED SOLUTION

Accepted Solutions

Atanu
Databricks Employee
Databricks Employee

We have API availabe for repos https://docs.databricks.com/dev-tools/api/latest/repos.html#operation/get-repos also we are currently supporting SP.

Step 1: As an admin Create a Service Principal

Use this API SCIM API 2.0 (ServicePrincipals) | Databricks on AWS

Related doc: โ€‹โ€‹https://docs.databricks.com/administration-guide/users-groups/service-principals.html 

Step 2: As an admin create a Databricks token on behalf of the Service Principal

Use this API:

Token Management API 2.0 | Databricks on AWS

Related doc: https://docs.databricks.com/administration-guide/users-groups/service-principals.html 

Step 3: Using the Service Principal Databricks Token call the Git Credentials API

Add the Git token via this API: Git Credentials API 2.0 | Databricks on AWS

Step 4: Invoke Repos APIs as service principal using the SPNs Databricks Token

Related stackoverflow questions: Databricks REST API call for updating branch error : User Settings > Git Integration to set up an Az...

View solution in original post

3 REPLIES 3

alefred
New Contributor II

Thanks @Kaniz Fatmaโ€‹ , I don't have problem creating PAT, the issue it's create the repo in databricks including the PAT.

PD: Take the consideration I don't wanna use Databricks user setting because everything it's deployed by command line.

Regards,

Luis

Atanu
Databricks Employee
Databricks Employee

We have API availabe for repos https://docs.databricks.com/dev-tools/api/latest/repos.html#operation/get-repos also we are currently supporting SP.

Step 1: As an admin Create a Service Principal

Use this API SCIM API 2.0 (ServicePrincipals) | Databricks on AWS

Related doc: โ€‹โ€‹https://docs.databricks.com/administration-guide/users-groups/service-principals.html 

Step 2: As an admin create a Databricks token on behalf of the Service Principal

Use this API:

Token Management API 2.0 | Databricks on AWS

Related doc: https://docs.databricks.com/administration-guide/users-groups/service-principals.html 

Step 3: Using the Service Principal Databricks Token call the Git Credentials API

Add the Git token via this API: Git Credentials API 2.0 | Databricks on AWS

Step 4: Invoke Repos APIs as service principal using the SPNs Databricks Token

Related stackoverflow questions: Databricks REST API call for updating branch error : User Settings > Git Integration to set up an Az...

jose_gonzalez
Databricks Employee
Databricks Employee

Hi @Luis Ariasโ€‹, 

Just a friendly follow-up. Did Atanu's response help you to resolved your question? please let us know

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