cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Administration & Architecture
Explore discussions on Databricks administration, deployment strategies, and architectural best practices. Connect with administrators and architects to optimize your Databricks environment for performance, scalability, and security.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

AzureDevOps Repos Databricks update via pipeline not working

TatiMun
New Contributor II

Hi all, im working with Azure DevOps and Databricks, using an app registration which it has permission on AzureDevOps and inside databricks as manager,user and in the group admins so it has permission over the repos.

Im doing a pipeline to update or create a Repo and its not working

 

- bash: |

   URL="$(DATABRICKS-HOST)/api/2.0/repos/{REPO_ID}"

   JSON_PAYLOAD='{
     "branch": "{BRANCH}",
     "sparse_checkout": {
       "patterns": [
         "parent-folder/child-folder"
       ]
     }
   }'

   curl -v --location --request PATCH "$URL" \
     --header "Authorization: Bearer $DATABRICKS_TOKEN" \
     --header "Content-Type: application/json" \
     --header "X-Databricks-Azure-SP-Management-Token: $ENTRAID_TOKEN" \
     --header "X-Databricks-Org-Id: {ORG_ID}" \
     --header "X-Databricks-Azure-Workspace-Resource-Id: /subscriptions/{SUBID}/resourceGroups/{RG}/providers/Microsoft.Databricks/workspaces/{DATABRICKS-NAME}" \
     --data "$JSON_PAYLOAD"

 I have created 3 tokens, PAT token, databricks token and EntraID token for this. Im using Data token to interact with databricks API.

Also before this step, i generate a git credential and then update the credential, get the repo id and try to update

{"error_code":"BAD_REQUEST","message":"Remote repo not found. Please ensure that:\n1. Your remote Git repo URL is valid.\n2. Your personal access token or app password has the correct repo access."}
2024-12-17T19:39:25.1346177Z 

It gives me back crendetials, repos, repo permission, etc.

2 REPLIES 2

Walter_C
Databricks Employee
Databricks Employee

Hello @TatiMun thanks for your question, can we review the following:

  1. Verify Remote URL: Double-check that the remote Git repo URL associated with the REPO_ID in Databricks is correct and accessible.
  2. Check PAT Permissions: Ensure that the Personal Access Token used for Git credentials has the necessary permissions to access the repository in Azure DevOps.
  3. Test Git Connection: Try cloning the repository manually using the service principal's credentials to verify access.
  4. API Permissions: Confirm that the service principal has the necessary API permissions in both Azure DevOps and Databricks.

TatiMun
New Contributor II

Hi walter, since im not using a PAT manually generated, im generating one (i think) via pipeline

The thing is that my pipeline works in a test frial enviroment, not in a closed one. I forgot to mentioned that im using a self hosted agent for azure devops

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