<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Use Azure Service Principal to Access Azure Devops in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/use-azure-service-principal-to-access-azure-devops/m-p/111813#M44005</link>
    <description>&lt;P&gt;what exactly is the "&lt;SPAN&gt;databricks_token" that you are using? If it's a personal access token generated using some user account again, I don't think you are solving the problem Sam is facing.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Mar 2025 10:25:59 GMT</pubDate>
    <dc:creator>KrunalG</dc:creator>
    <dc:date>2025-03-05T10:25:59Z</dc:date>
    <item>
      <title>Use Azure Service Principal to Access Azure Devops</title>
      <link>https://community.databricks.com/t5/data-engineering/use-azure-service-principal-to-access-azure-devops/m-p/83148#M36853</link>
      <description>&lt;P&gt;There is another thread marked as answered, but it is not a working solution:&amp;nbsp;&lt;A href="https://community.databricks.com/t5/data-engineering/how-to-use-databricks-repos-with-a-service-principal-for-ci-cd/td-p/11789/page/2" target="_blank"&gt;Solved: How to use Databricks Repos with a service princip... - Page 2 - Databricks Community - 11789&lt;/A&gt;&lt;/P&gt;&lt;P&gt;In Azure Devops, there doesn't seem to be a way to generate a PAT for a service principal user.&amp;nbsp; I want to use a devops repo as a source for a job step, but this is a blocker.&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can connect with an Entra ID, which would seem plausible if Databricks implemented it.&amp;nbsp;&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/azure/devops/integrate/get-started/authentication/service-principal-managed-identity?view=azure-devops#3-access-azure-devops-resources-with-a-microsoft-entra-id-token" target="_blank"&gt;Use service principals &amp;amp; managed identities - Azure DevOps | Microsoft Learn&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2024 23:36:02 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/use-azure-service-principal-to-access-azure-devops/m-p/83148#M36853</guid>
      <dc:creator>SamGreene</dc:creator>
      <dc:date>2024-08-15T23:36:02Z</dc:date>
    </item>
    <item>
      <title>Re: Use Azure Service Principal to Access Azure Devops</title>
      <link>https://community.databricks.com/t5/data-engineering/use-azure-service-principal-to-access-azure-devops/m-p/105632#M42213</link>
      <description>&lt;P&gt;Hi, I'm still looking for an answer to this. It seems the recommended way to use repos is NOT to use a shared folder, but if we can't get our SP to source code from Git, then we are stuck using the shared folder repo solution. Being able to use code directly from devops would also remove a step from our production promotion process where we have to pull code from Git to the shared folder.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 17:47:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/use-azure-service-principal-to-access-azure-devops/m-p/105632#M42213</guid>
      <dc:creator>SamGreene</dc:creator>
      <dc:date>2025-01-14T17:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: Use Azure Service Principal to Access Azure Devops</title>
      <link>https://community.databricks.com/t5/data-engineering/use-azure-service-principal-to-access-azure-devops/m-p/105633#M42214</link>
      <description>&lt;P&gt;Another issue is that another team member created these shared folders and synced them to Git, and now, after they left the team, I need to recreate all the folders to transfer permissions to myself....&lt;/P&gt;&lt;P&gt;I guess the other option is we stop using service principals to run jobs?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 17:51:05 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/use-azure-service-principal-to-access-azure-devops/m-p/105633#M42214</guid>
      <dc:creator>SamGreene</dc:creator>
      <dc:date>2025-01-14T17:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: Use Azure Service Principal to Access Azure Devops</title>
      <link>https://community.databricks.com/t5/data-engineering/use-azure-service-principal-to-access-azure-devops/m-p/105638#M42219</link>
      <description>&lt;P&gt;Isnt this method applicable for you&amp;nbsp;&lt;A href="https://docs.databricks.com/en/dev-tools/ci-cd/ci-cd-sp.html" target="_blank"&gt;https://docs.databricks.com/en/dev-tools/ci-cd/ci-cd-sp.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 19:07:44 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/use-azure-service-principal-to-access-azure-devops/m-p/105638#M42219</guid>
      <dc:creator>Walter_C</dc:creator>
      <dc:date>2025-01-14T19:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: Use Azure Service Principal to Access Azure Devops</title>
      <link>https://community.databricks.com/t5/data-engineering/use-azure-service-principal-to-access-azure-devops/m-p/105683#M42237</link>
      <description>&lt;P&gt;1) Is your SP already onboarded for Azure devops? otherwise first step is to granting sp access to azure devops so it is available for your repos and authorized.&lt;/P&gt;&lt;P&gt;2) do you want to do this manually or via pipeline?&lt;/P&gt;&lt;P&gt;3) setup your job runas to this sp.&lt;/P&gt;&lt;P&gt;4)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="saurabh18cs_0-1736936663130.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/14103iB03CE1C534EA5FB0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="saurabh18cs_0-1736936663130.png" alt="saurabh18cs_0-1736936663130.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 10:24:30 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/use-azure-service-principal-to-access-azure-devops/m-p/105683#M42237</guid>
      <dc:creator>saurabh18cs</dc:creator>
      <dc:date>2025-01-15T10:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: Use Azure Service Principal to Access Azure Devops</title>
      <link>https://community.databricks.com/t5/data-engineering/use-azure-service-principal-to-access-azure-devops/m-p/105689#M42241</link>
      <description>&lt;P&gt;Let me share process to authenticate and then execute and test your workflow: offcource you can make below pseudocode more industralized which suits you better&lt;/P&gt;&lt;P&gt;import requests&lt;BR /&gt;import json&lt;BR /&gt;import os&lt;/P&gt;&lt;P&gt;# Define environment variables and parameters&lt;BR /&gt;env = os.getenv('env', 'dev') # Replace with the actual way to get the environment variable&lt;BR /&gt;sp_app_id_dev = 'your_sp_app_id_dev'&lt;BR /&gt;sp_app_id_acc = 'your_sp_app_id_acc'&lt;BR /&gt;sp_app_id_prd = 'your_sp_app_id_prd'&lt;BR /&gt;SP_SECRET_DEV = 'your_sp_secret_dev'&lt;BR /&gt;SP_SECRET_ACC = 'your_sp_secret_acc'&lt;BR /&gt;SP_SECRET_PRD = 'your_sp_secret_prd'&lt;BR /&gt;databricks_wrkspc_url_dev = 'your_databricks_wrkspc_url_dev'&lt;BR /&gt;databricks_wrkspc_url_acc = 'your_databricks_wrkspc_url_acc'&lt;BR /&gt;databricks_wrkspc_url_prd = 'your_databricks_wrkspc_url_prd'&lt;BR /&gt;databricks_token = 'your_databricks_token' # Replace with the actual way to get the Databricks token&lt;/P&gt;&lt;P&gt;# Determine the environment and set the corresponding variables&lt;BR /&gt;if env == 'dev':&lt;BR /&gt;CLIENT_ID = sp_app_id_dev&lt;BR /&gt;CLIENT_SECRET = SP_SECRET_DEV&lt;BR /&gt;databricksWorkspaceUrl = databricks_wrkspc_url_dev&lt;BR /&gt;elif env == 'acc':&lt;BR /&gt;CLIENT_ID = sp_app_id_acc&lt;BR /&gt;CLIENT_SECRET = SP_SECRET_ACC&lt;BR /&gt;databricksWorkspaceUrl = databricks_wrkspc_url_acc&lt;BR /&gt;else:&lt;BR /&gt;CLIENT_ID = sp_app_id_prd&lt;BR /&gt;CLIENT_SECRET = SP_SECRET_PRD&lt;BR /&gt;databricksWorkspaceUrl = databricks_wrkspc_url_prd&lt;/P&gt;&lt;P&gt;# Get the OAuth token&lt;BR /&gt;token_url = "&lt;A href="https://login.microsoftonline.com/" target="_blank"&gt;https://login.microsoftonline.com/&lt;/A&gt;&amp;lt;&amp;lt;TENANTID&amp;gt;&amp;gt;/oauth2/v2.0/token"&lt;BR /&gt;payload = {&lt;BR /&gt;'client_id': CLIENT_ID,&lt;BR /&gt;'grant_type': 'client_credentials',&lt;BR /&gt;'scope': '499b84ac-1321-427f-aa17-267ca6975798/.default',&lt;BR /&gt;'client_secret': CLIENT_SECRET&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;response = requests.post(token_url, data=payload)&lt;BR /&gt;response.raise_for_status() # Raise an error for bad status codes&lt;BR /&gt;sp_devops_token_val = response.json()&lt;BR /&gt;sp_devops_token = sp_devops_token_val.get('access_token')&lt;/P&gt;&lt;P&gt;print(f"SP DevOps Token: {sp_devops_token}")&lt;/P&gt;&lt;P&gt;# Set up Databricks Git credentials&lt;BR /&gt;DATABRICKS_GIT_URL = f"{databricksWorkspaceUrl}/api/2.0/git-credentials"&lt;BR /&gt;gitConfig = {&lt;BR /&gt;"personal_access_token": sp_devops_token,&lt;BR /&gt;"git_username": "gbr_sp",&lt;BR /&gt;"git_provider": "azureDevOpsServices"&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;headers = {&lt;BR /&gt;"Authorization": f"Bearer {databricks_token}",&lt;BR /&gt;"Accept": "application/json"&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;# Check if Git credentials already exist&lt;BR /&gt;git_exists_response = requests.get(DATABRICKS_GIT_URL, headers=headers)&lt;BR /&gt;git_exists_response.raise_for_status()&lt;BR /&gt;git_exists = git_exists_response.json().get('credentials', [])&lt;/P&gt;&lt;P&gt;if not git_exists:&lt;BR /&gt;# Create new Git credentials&lt;BR /&gt;create_response = requests.post(DATABRICKS_GIT_URL, headers=headers, json=gitConfig)&lt;BR /&gt;create_response.raise_for_status()&lt;BR /&gt;print("Git credentials created successfully.")&lt;BR /&gt;else:&lt;BR /&gt;# Update existing Git credentials&lt;BR /&gt;cred_id = git_exists[0].get('credential_id')&lt;BR /&gt;if not cred_id:&lt;BR /&gt;print("Credential Id is null")&lt;BR /&gt;exit(1)&lt;BR /&gt;else:&lt;BR /&gt;update_url = f"{DATABRICKS_GIT_URL}/{cred_id}"&lt;BR /&gt;update_response = requests.patch(update_url, headers=headers, json=gitConfig)&lt;BR /&gt;update_response.raise_for_status()&lt;BR /&gt;print("Git credentials updated successfully.")&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 10:20:01 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/use-azure-service-principal-to-access-azure-devops/m-p/105689#M42241</guid>
      <dc:creator>saurabh18cs</dc:creator>
      <dc:date>2025-01-15T10:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: Use Azure Service Principal to Access Azure Devops</title>
      <link>https://community.databricks.com/t5/data-engineering/use-azure-service-principal-to-access-azure-devops/m-p/105811#M42265</link>
      <description>&lt;P&gt;SP Access to the Databricks workspace -&amp;nbsp;&lt;/P&gt;&lt;P&gt;The service principal, underlying the Azure DevOps service connection, should be granted the required permissions to the databricks workspace and underlying catalog objects. Create a databricks workflow and make the principal as the owner with execution rights.&lt;/P&gt;&lt;P&gt;Optional Step- You can test this approach with the below sample code to be executed through Azure CLI task from a release pipeline. The SP deploys the code/notebooks through AAD authentication from the build location.&lt;/P&gt;&lt;P&gt;python.exe -m pip install --upgrade pip databricks-cli&lt;BR /&gt;$token=$(az account get-access-token --resource 2ff814a6-3304-4ab8-85cb-cd0e6f879c1d --query "accessToken" --output tsv)&lt;BR /&gt;$Env:DATABRICKS_AAD_TOKEN = $token&lt;BR /&gt;databricks configure --aad-token --host $(DatabricksUCDomain)&lt;BR /&gt;databricks --debug workspace import_dir $(System.DefaultWorkingDirectory)/ArtifactsDrop/ ///Workspace/ProjectFolder/ --overwrite&lt;/P&gt;&lt;P&gt;DevOps Service Connection screen to identify the Principal&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MadhuB_2-1736978008308.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/14158i7E92F18D19CB2F56/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MadhuB_2-1736978008308.png" alt="MadhuB_2-1736978008308.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Workflow Execution -&lt;BR /&gt;The SP should be granted Service principal: Manager and Service principal: User roles in the databricks admin console for the successful execution of the Job. Further make the SP as the Owner of the workflow. Refer to the below screens.&lt;/P&gt;&lt;P&gt;Screens to Grant SP access in the admin account console -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MadhuB_1-1736977857890.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/14157i9CCAE4D950626772/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MadhuB_1-1736977857890.png" alt="MadhuB_1-1736977857890.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MadhuB_0-1736977808361.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/14156i0517F3B11F7D9C2E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MadhuB_0-1736977808361.png" alt="MadhuB_0-1736977808361.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 21:53:48 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/use-azure-service-principal-to-access-azure-devops/m-p/105811#M42265</guid>
      <dc:creator>MadhuB</dc:creator>
      <dc:date>2025-01-15T21:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: Use Azure Service Principal to Access Azure Devops</title>
      <link>https://community.databricks.com/t5/data-engineering/use-azure-service-principal-to-access-azure-devops/m-p/105817#M42268</link>
      <description>&lt;P&gt;I found this article - it looks like the scenario I am trying to implement.&amp;nbsp; I want to be able to point a production job running as an SP at an Azure Devops Git asset.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/databricks/dev-tools/ci-cd/use-ms-entra-sp-with-devops" target="_blank"&gt;Use a Microsoft Entra service principal to authenticate access to Azure Databricks Git folders - Azure Databricks | Microsoft Learn&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 00:11:29 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/use-azure-service-principal-to-access-azure-devops/m-p/105817#M42268</guid>
      <dc:creator>SamGreene</dc:creator>
      <dc:date>2025-01-16T00:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: Use Azure Service Principal to Access Azure Devops</title>
      <link>https://community.databricks.com/t5/data-engineering/use-azure-service-principal-to-access-azure-devops/m-p/105863#M42291</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/95294"&gt;@SamGreene&lt;/a&gt;&amp;nbsp;have you tried what i suggested above?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 10:05:22 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/use-azure-service-principal-to-access-azure-devops/m-p/105863#M42291</guid>
      <dc:creator>saurabh18cs</dc:creator>
      <dc:date>2025-01-16T10:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: Use Azure Service Principal to Access Azure Devops</title>
      <link>https://community.databricks.com/t5/data-engineering/use-azure-service-principal-to-access-azure-devops/m-p/111813#M44005</link>
      <description>&lt;P&gt;what exactly is the "&lt;SPAN&gt;databricks_token" that you are using? If it's a personal access token generated using some user account again, I don't think you are solving the problem Sam is facing.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2025 10:25:59 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/use-azure-service-principal-to-access-azure-devops/m-p/111813#M44005</guid>
      <dc:creator>KrunalG</dc:creator>
      <dc:date>2025-03-05T10:25:59Z</dc:date>
    </item>
    <item>
      <title>Re: Use Azure Service Principal to Access Azure Devops</title>
      <link>https://community.databricks.com/t5/data-engineering/use-azure-service-principal-to-access-azure-devops/m-p/111875#M44022</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/152041"&gt;@KrunalG&lt;/a&gt;&amp;nbsp;you can deploy using databricks PAT (impersonation technique) or AAD authentication of a service principal.&amp;nbsp;&lt;BR /&gt;SP AAD token is safest as the default expiry time set to 60 mins. Refer to my detailed explanation in the below.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2025 22:34:33 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/use-azure-service-principal-to-access-azure-devops/m-p/111875#M44022</guid>
      <dc:creator>MadhuB</dc:creator>
      <dc:date>2025-03-05T22:34:33Z</dc:date>
    </item>
  </channel>
</rss>

