<?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: OAUTH Secrets Rotation for Service Principal through Databricks CLI in Administration &amp; Architecture</title>
    <link>https://community.databricks.com/t5/administration-architecture/oauth-secrets-rotation-for-service-principal-through-databricks/m-p/102404#M2530</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/106294"&gt;@Alberto_Umana&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;That's perfectly fine, to replace it. For me replacing the old secret with a new secret is effectively the same as renewing the secret. So could you help me with how to replace the secret?&lt;/P&gt;&lt;P&gt;And if it is simply using the Databricks REST API. I imagine this should also be executable for agents in Azure Devops Pipeline instead of Azure Functions right?&lt;/P&gt;</description>
    <pubDate>Tue, 17 Dec 2024 15:15:29 GMT</pubDate>
    <dc:creator>Rob_Lemmens</dc:creator>
    <dc:date>2024-12-17T15:15:29Z</dc:date>
    <item>
      <title>OAUTH Secrets Rotation for Service Principal through Databricks CLI</title>
      <link>https://community.databricks.com/t5/administration-architecture/oauth-secrets-rotation-for-service-principal-through-databricks/m-p/102390#M2524</link>
      <description>&lt;P&gt;I am currently utilizing a specific Service Principal in my DevOps steps to utilize the Databricks CLI. It's using the OAuth tokens with M2M authentication (&lt;A href="https://learn.microsoft.com/en-us/azure/databricks/dev-tools/auth/oauth-m2m" target="_blank" rel="nofollow noopener noreferrer"&gt;Authenticate access to Azure Databricks with a service principal using OAuth (OAuth M2M) - Azure Databricks | Microsoft Learn&lt;/A&gt;). And I use the Client ID and Client Secret, which I store (as plain text) to the datarbicks config file (.databrickscfg&lt;SPAN&gt;&amp;nbsp;)&lt;/SPAN&gt; for authorization.&lt;/P&gt;&lt;P class="lia-align-left"&gt;I created the secret manually and uploaded it to KeyVault. But I want to programatically renew this Secret every 2 months. Otherwise it is not in line with the security requirements of my company. However, I don't see a straightforward way of doing this through the Databricks CLI. Can someone help with this?&lt;/P&gt;&lt;P&gt;This question is also asked (amongst other questions) in this thread:&lt;BR /&gt;&lt;A href="https://community.databricks.com/t5/administration-architecture/security-consideration-for-oauth-secrets-to-use-service/m-p/78227#M1362" target="_blank" rel="noopener"&gt;Security Consideration for OAUTH Secrets to use Se... - Databricks Community - 78227 &lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 14:08:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/oauth-secrets-rotation-for-service-principal-through-databricks/m-p/102390#M2524</guid>
      <dc:creator>Rob_Lemmens</dc:creator>
      <dc:date>2024-12-17T14:08:21Z</dc:date>
    </item>
    <item>
      <title>Re: OAUTH Secrets Rotation for Service Principal through Databricks CLI</title>
      <link>https://community.databricks.com/t5/administration-architecture/oauth-secrets-rotation-for-service-principal-through-databricks/m-p/102392#M2525</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/104276"&gt;@Rob_Lemmens&lt;/a&gt;,&lt;/P&gt;
&lt;P class="p1"&gt;To programmatically renew OAuth secrets for a Service Principal every 2 months, you can follow these steps:&lt;/P&gt;
&lt;OL class="ol1"&gt;
&lt;LI class="li1"&gt;&lt;STRONG&gt;Create a Service Principal and OAuth Secret:&lt;/STRONG&gt;&lt;/LI&gt;
&lt;UL class="ul1"&gt;
&lt;LI class="li1"&gt;Follow the steps in the &lt;A href="https://learn.microsoft.com/en-us/azure/databricks/dev-tools/auth/oauth-m2m" target="_blank"&gt;&lt;SPAN class="s2"&gt;Azure Databricks documentation&lt;/SPAN&gt;&lt;/A&gt; to create a Service Principal and generate an OAuth secret.&lt;/LI&gt;
&lt;/UL&gt;
&lt;LI class="li1"&gt;&lt;STRONG&gt;Store the Secret in Azure Key Vault:&lt;/STRONG&gt;&lt;/LI&gt;
&lt;UL class="ul1"&gt;
&lt;LI class="li1"&gt;Store the generated OAuth secret in Azure Key Vault for secure access.&lt;/LI&gt;
&lt;/UL&gt;
&lt;LI class="li1"&gt;&lt;STRONG&gt;Automate Secret Renewal:&lt;/STRONG&gt;&lt;/LI&gt;
&lt;UL class="ul1"&gt;
&lt;LI class="li1"&gt;Use Azure Functions or Azure Automation to create a scheduled task that runs every 2 months.&lt;/LI&gt;
&lt;LI class="li1"&gt;The task should:&lt;/LI&gt;
&lt;UL class="ul1"&gt;
&lt;LI class="li1"&gt;Generate a new OAuth secret using the Databricks REST API.&lt;/LI&gt;
&lt;LI class="li1"&gt;Update the secret in Azure Key Vault.&lt;/LI&gt;
&lt;/UL&gt;
&lt;/UL&gt;
&lt;LI class="li1"&gt;&lt;STRONG&gt;Update .databrickscfg File:&lt;/STRONG&gt;&lt;/LI&gt;
&lt;UL class="ul1"&gt;
&lt;LI class="li1"&gt;Ensure your DevOps pipeline retrieves the latest secret from Azure Key Vault and updates the .databrickscfg file before using the Databricks CLI.&lt;/LI&gt;
&lt;/UL&gt;
&lt;/OL&gt;
&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;STRONG&gt;Example Azure Function to Renew OAuth Secret&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;import os&lt;/P&gt;
&lt;P class="p1"&gt;import requests&lt;/P&gt;
&lt;P class="p1"&gt;from azure.identity import DefaultAzureCredential&lt;/P&gt;
&lt;P class="p1"&gt;from azure.keyvault.secrets import SecretClient&lt;/P&gt;
&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;# Azure Key Vault details&lt;/P&gt;
&lt;P class="p1"&gt;key_vault_name = os.environ[&lt;/P&gt;
&lt;P class="p1"&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/databricks/dev-tools/auth/oauth-m2m" target="_blank"&gt;https://learn.microsoft.com/en-us/azure/databricks/dev-tools/auth/oauth-m2m&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 14:11:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/oauth-secrets-rotation-for-service-principal-through-databricks/m-p/102392#M2525</guid>
      <dc:creator>Alberto_Umana</dc:creator>
      <dc:date>2024-12-17T14:11:03Z</dc:date>
    </item>
    <item>
      <title>Re: OAUTH Secrets Rotation for Service Principal through Databricks CLI</title>
      <link>https://community.databricks.com/t5/administration-architecture/oauth-secrets-rotation-for-service-principal-through-databricks/m-p/102396#M2528</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/106294"&gt;@Alberto_Umana&lt;/a&gt;, for the quick reply&lt;/P&gt;&lt;P&gt;So I want to know about step 3. Could you elaborate on that?&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Because so far I only see ways to create actual OAuth &lt;STRONG&gt;tokens&lt;/STRONG&gt; in Databricks REST API. I don't see how to actually renew the OAuth&amp;nbsp;&lt;STRONG&gt;secret.&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Tue, 17 Dec 2024 14:23:26 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/oauth-secrets-rotation-for-service-principal-through-databricks/m-p/102396#M2528</guid>
      <dc:creator>Rob_Lemmens</dc:creator>
      <dc:date>2024-12-17T14:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: OAUTH Secrets Rotation for Service Principal through Databricks CLI</title>
      <link>https://community.databricks.com/t5/administration-architecture/oauth-secrets-rotation-for-service-principal-through-databricks/m-p/102398#M2529</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/104276"&gt;@Rob_Lemmens&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;There is no direct method to renew an OAuth secret. Instead, you can create a new OAuth secret and replace the old one. You might need to create an Azure Function or Azure Automation runbook that will execute the renewal process every 2 months, but to replace the token, unfortunately cannot be renewed.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 14:49:05 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/oauth-secrets-rotation-for-service-principal-through-databricks/m-p/102398#M2529</guid>
      <dc:creator>Alberto_Umana</dc:creator>
      <dc:date>2024-12-17T14:49:05Z</dc:date>
    </item>
    <item>
      <title>Re: OAUTH Secrets Rotation for Service Principal through Databricks CLI</title>
      <link>https://community.databricks.com/t5/administration-architecture/oauth-secrets-rotation-for-service-principal-through-databricks/m-p/102404#M2530</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/106294"&gt;@Alberto_Umana&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;That's perfectly fine, to replace it. For me replacing the old secret with a new secret is effectively the same as renewing the secret. So could you help me with how to replace the secret?&lt;/P&gt;&lt;P&gt;And if it is simply using the Databricks REST API. I imagine this should also be executable for agents in Azure Devops Pipeline instead of Azure Functions right?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 15:15:29 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/oauth-secrets-rotation-for-service-principal-through-databricks/m-p/102404#M2530</guid>
      <dc:creator>Rob_Lemmens</dc:creator>
      <dc:date>2024-12-17T15:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: OAUTH Secrets Rotation for Service Principal through Databricks CLI</title>
      <link>https://community.databricks.com/t5/administration-architecture/oauth-secrets-rotation-for-service-principal-through-databricks/m-p/102617#M2558</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;This question is not answered yet. Could someone help me with it? Or is it not possible to programatically update oauth secrets through the Databricks REST API?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 07:21:30 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/oauth-secrets-rotation-for-service-principal-through-databricks/m-p/102617#M2558</guid>
      <dc:creator>Rob_Lemmens</dc:creator>
      <dc:date>2024-12-19T07:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: OAUTH Secrets Rotation for Service Principal through Databricks CLI</title>
      <link>https://community.databricks.com/t5/administration-architecture/oauth-secrets-rotation-for-service-principal-through-databricks/m-p/102668#M2570</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/104276"&gt;@Rob_Lemmens&lt;/a&gt;&amp;nbsp;- please refer to the API documentation:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.databricks.com/api/workspace/secrets/createscope" target="_blank"&gt;https://docs.databricks.com/api/workspace/secrets/createscope&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.databricks.com/api/workspace/secrets" target="_blank"&gt;https://docs.databricks.com/api/workspace/secrets&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;curl -X POST https://&amp;lt;databricks-instance&amp;gt;/api/2.0/secrets/scopes/create \&lt;BR /&gt;-H "Authorization: Bearer &amp;lt;your-access-token&amp;gt;" \&lt;BR /&gt;-d '{&lt;BR /&gt;"scope": "my-scope",&lt;BR /&gt;"initial_manage_principal": "users"&lt;BR /&gt;}'&lt;/P&gt;
&lt;P&gt;Replace &lt;CODE&gt;&amp;lt;databricks-instance&amp;gt;&lt;/CODE&gt; with your Databricks workspace URL and &lt;CODE&gt;&amp;lt;your-access-token&amp;gt;&lt;/CODE&gt; with your Databricks access token.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/databricks/dev-tools/ci-cd/auth-with-azure-devops" target="_blank"&gt;https://learn.microsoft.com/en-us/azure/databricks/dev-tools/ci-cd/auth-with-azure-devops&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 14:48:59 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/oauth-secrets-rotation-for-service-principal-through-databricks/m-p/102668#M2570</guid>
      <dc:creator>Alberto_Umana</dc:creator>
      <dc:date>2024-12-19T14:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: OAUTH Secrets Rotation for Service Principal through Databricks CLI</title>
      <link>https://community.databricks.com/t5/administration-architecture/oauth-secrets-rotation-for-service-principal-through-databricks/m-p/102769#M2580</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/106294"&gt;@Alberto_Umana&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thanks for reaching out again.&lt;/P&gt;&lt;P&gt;The second point with the link for auth-with-azure-devops seems promising. I will look into it and let you know if it helped!&lt;/P&gt;&lt;P&gt;The first links to the API for the secrets are not the secrets I have been referring to in this thread. I was referring to the OAuth Secret of a Service Principal (I added a screenshot to the comment)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 10:34:46 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/oauth-secrets-rotation-for-service-principal-through-databricks/m-p/102769#M2580</guid>
      <dc:creator>Rob_Lemmens</dc:creator>
      <dc:date>2024-12-20T10:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: OAUTH Secrets Rotation for Service Principal through Databricks CLI</title>
      <link>https://community.databricks.com/t5/administration-architecture/oauth-secrets-rotation-for-service-principal-through-databricks/m-p/103046#M2588</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/104276"&gt;@Rob_Lemmens&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Thanks for clarifying about the secrets. So this one might help you:&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/azure/databricks/dev-tools/auth/oauth-m2m" target="_blank"&gt;https://learn.microsoft.com/en-us/azure/databricks/dev-tools/auth/oauth-m2m&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2024 16:56:46 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/oauth-secrets-rotation-for-service-principal-through-databricks/m-p/103046#M2588</guid>
      <dc:creator>Alberto_Umana</dc:creator>
      <dc:date>2024-12-23T16:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: OAUTH Secrets Rotation for Service Principal through Databricks CLI</title>
      <link>https://community.databricks.com/t5/administration-architecture/oauth-secrets-rotation-for-service-principal-through-databricks/m-p/107530#M2868</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After filing a Microsoft Support Ticket through my client they provided me with the solution to the inquiry. There seems to be a undocumented API call that you can do to create this SP Oauth Client Secret and it works perfectly:&lt;/P&gt;&lt;P data-unlink="true"&gt;curl -X POST --header "Authorization: Bearer &amp;lt;token&amp;gt;" https://&amp;lt;workspace-host-url&amp;gt;/api/2.0/accounts/servicePrincipals/&amp;lt;service-principal-id&amp;gt;/credentials/secrets&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is one of the open issues at Databricks (&lt;A href="https://github.com/databricks/terraform-provider-databricks/issues/3363#issuecomment-2122177117" target="_blank" rel="noopener"&gt;https://github.com/databricks/terraform-provider-databricks/issues/3363#issuecomment-2122177117)&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2025 08:49:10 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/oauth-secrets-rotation-for-service-principal-through-databricks/m-p/107530#M2868</guid>
      <dc:creator>Rob_Lemmens</dc:creator>
      <dc:date>2025-01-29T08:49:10Z</dc:date>
    </item>
  </channel>
</rss>

