<?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: Databricks service principal token federation on Kubernetes in Administration &amp; Architecture</title>
    <link>https://community.databricks.com/t5/administration-architecture/databricks-service-principal-token-federation-on-kubernetes/m-p/134757#M4203</link>
    <description>&lt;P&gt;Gotcha. Can you describe what is not working? Any specific error or behaviour?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Oct 2025 14:25:23 GMT</pubDate>
    <dc:creator>sarahbhord</dc:creator>
    <dc:date>2025-10-13T14:25:23Z</dc:date>
    <item>
      <title>Databricks service principal token federation on Kubernetes</title>
      <link>https://community.databricks.com/t5/administration-architecture/databricks-service-principal-token-federation-on-kubernetes/m-p/130187#M3979</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a service principal federation policy against AKS cluster. But I am struggling to make it work without any examples.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It would be great if you could share examples on how this would work for a service account.&lt;BR /&gt;Additionally, what I would like to know is, does databricks inject tokens into the pod, or does it need the Azure workload identity federated token to communicate to databricks? In the latter case, how is it different from oauth m2m flow.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Aug 2025 16:52:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/databricks-service-principal-token-federation-on-kubernetes/m-p/130187#M3979</guid>
      <dc:creator>sparkplug</dc:creator>
      <dc:date>2025-08-29T16:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks service principal token federation on Kubernetes</title>
      <link>https://community.databricks.com/t5/administration-architecture/databricks-service-principal-token-federation-on-kubernetes/m-p/132131#M4053</link>
      <description>&lt;P&gt;Hey sparkplug - Thanks for reaching out!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To enable a service account in AKS to authenticate to Databricks using workload identity federation, you must create a service principal federation policy in Databricks that allows tokens issued by the Kubernetes cluster acting as the OIDC provider.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Federation Policy Example (for Kubernetes Service Account):&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;Key parameters:&lt;/P&gt;
&lt;UL class="qt3gz97 qt3gz92"&gt;
&lt;LI class="qt3gz9a"&gt;Issuer: OIDC endpoint of the Kubernetes cluster (typically &lt;CODE class="qt3gz9f"&gt;&lt;A href="https://kubernetes.default.svc" target="_blank"&gt;https://kubernetes.default.svc&lt;/A&gt;&lt;/CODE&gt; for in-cluster workloads)&lt;/LI&gt;
&lt;LI class="qt3gz9a"&gt;Audience: Also usually &lt;CODE class="qt3gz9f"&gt;&lt;A href="https://kubernetes.default.svc" target="_blank"&gt;https://kubernetes.default.svc&lt;/A&gt;&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI class="qt3gz9a"&gt;Subject: The Kubernetes service account in the form &lt;CODE class="qt3gz9f"&gt;system:serviceaccount:&amp;lt;namespace&amp;gt;:&amp;lt;serviceaccount-name&amp;gt;&lt;/CODE&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Sample Policy (using Databricks CLI):&lt;/P&gt;
&lt;DIV class="go8b9g1 _7pq7t6c8"&gt;
&lt;PRE&gt;&lt;CODE class="markdown-code-bash qt3gz9e hljs language-bash _1ymogdh2"&gt;databricks account service-principal-federation-policy create &amp;lt;SERVICE_PRINCIPAL_NUMERIC_ID&amp;gt; --json \
&lt;SPAN class="hljs-string"&gt;'{
  "oidc_policy": {
    "issuer": "https://kubernetes.default.svc",
    "audiences": ["https://kubernetes.default.svc"],
    "subject": "system:serviceaccount:my-namespace:my-serviceaccount"
  }
}'&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;P&gt;Corresponding JWT Claims:&lt;/P&gt;
&lt;DIV class="go8b9g1 _7pq7t6c8"&gt;
&lt;PRE&gt;&lt;CODE class="markdown-code-json qt3gz9e hljs language-json _1ymogdh2"&gt;&lt;SPAN class="hljs-punctuation"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="hljs-attr"&gt;"iss"&lt;/SPAN&gt;&lt;SPAN class="hljs-punctuation"&gt;:&lt;/SPAN&gt; &lt;SPAN class="hljs-string"&gt;"https://kubernetes.default.svc"&lt;/SPAN&gt;&lt;SPAN class="hljs-punctuation"&gt;,&lt;/SPAN&gt;
  &lt;SPAN class="hljs-attr"&gt;"aud"&lt;/SPAN&gt;&lt;SPAN class="hljs-punctuation"&gt;:&lt;/SPAN&gt; &lt;SPAN class="hljs-punctuation"&gt;[&lt;/SPAN&gt;&lt;SPAN class="hljs-string"&gt;"https://kubernetes.default.svc"&lt;/SPAN&gt;&lt;SPAN class="hljs-punctuation"&gt;]&lt;/SPAN&gt;&lt;SPAN class="hljs-punctuation"&gt;,&lt;/SPAN&gt;
  &lt;SPAN class="hljs-attr"&gt;"sub"&lt;/SPAN&gt;&lt;SPAN class="hljs-punctuation"&gt;:&lt;/SPAN&gt; &lt;SPAN class="hljs-string"&gt;"system:serviceaccount:my-namespace:my-serviceaccount"&lt;/SPAN&gt;
&lt;SPAN class="hljs-punctuation"&gt;}&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;UL class="qt3gz97 qt3gz92"&gt;
&lt;LI class="qt3gz9a"&gt;You can also configure this via Databricks REST API or UI ("Federation policies" tab under service principal details).&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/azure/databricks/dev-tools/auth/oauth-federation-policy" target="_blank"&gt;https://learn.microsoft.com/en-us/azure/databricks/dev-tools/auth/oauth-federation-policy&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Terraform Example (resource arguments):&amp;nbsp;&lt;A href="https://github.com/databricks/terraform-provider-databricks/blob/main/docs/resources/service_principal_federation_policy.md" target="_blank"&gt;https://github.com/databricks/terraform-provider-databricks/blob/main/docs/resources/service_principal_federation_policy.md&lt;/A&gt;&lt;/P&gt;
&lt;UL class="qt3gz97 qt3gz92"&gt;
&lt;LI class="qt3gz9a"&gt;&lt;CODE class="qt3gz9f"&gt;issuer&lt;/CODE&gt; (string): OIDC issuer URL&lt;/LI&gt;
&lt;LI class="qt3gz9a"&gt;&lt;CODE class="qt3gz9f"&gt;audiences&lt;/CODE&gt; (list): List of valid audience values&lt;/LI&gt;
&lt;LI class="qt3gz9a"&gt;&lt;CODE class="qt3gz9f"&gt;subject&lt;/CODE&gt; (string): Required Kubernetes service account identifier&lt;/LI&gt;
&lt;LI class="qt3gz9a"&gt;&lt;CODE class="qt3gz9f"&gt;subject_claim&lt;/CODE&gt; (optional): Defaults to &lt;CODE class="qt3gz9f"&gt;sub&lt;/CODE&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P class="_7uu25p0 qt3gz9c _7pq7t612 heading3 _7uu25p1"&gt;&lt;U&gt;Databricks Integration: Token Handling in AKS Pods&lt;/U&gt;&lt;/P&gt;
&lt;P class="_7uu25p0 qt3gz9c _7pq7t612 heading4 _7uu25p1"&gt;Databricks does not directly inject Databricks tokens into pods in AKS clusters.&lt;/P&gt;
&lt;P class="_7uu25p0 qt3gz9c _7pq7t612 heading4 _7uu25p1"&gt;&lt;EM&gt;How does the authentication work?&lt;/EM&gt;&lt;/P&gt;
&lt;UL class="qt3gz97 qt3gz92"&gt;
&lt;LI class="qt3gz9a"&gt;With Azure Workload Identity Federation, the Kubernetes pod receives a short-lived, projected service account token.&lt;/LI&gt;
&lt;LI class="qt3gz9a"&gt;This token is used by the pod to exchange with Azure Entra ID (previously Azure AD) for an access token, which can then be used to access Databricks (or any other Azure resource).&lt;/LI&gt;
&lt;LI class="qt3gz9a"&gt;The workflow for a pod:
&lt;UL class="qt3gz98 qt3gz92"&gt;
&lt;LI class="qt3gz9a"&gt;Receives a service account token via a projected volume.&lt;/LI&gt;
&lt;LI class="qt3gz9a"&gt;The application in the pod uses this token (following the federation policy described above) to exchange for a Databricks OAuth token.&lt;/LI&gt;
&lt;LI class="qt3gz9a"&gt;The Databricks CLI/SDK (or your code) handles the token exchange process using environment variables or token file paths provided by the Azure Workload Identity webhook.
&lt;DIV class="_7pq7t614 _7pq7t6c8 wrz27r2 wrz27r0"&gt;&lt;SPAN class="xh5urp3 xh5urp1 xh5urp0" aria-label="3 sources"&gt;3 sources&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;YAML Pod Configuration Example (key extracts):&lt;/P&gt;
&lt;DIV class="go8b9g1 _7pq7t6c8"&gt;
&lt;PRE&gt;&lt;CODE class="markdown-code-yaml qt3gz9e hljs language-yaml _1ymogdh2"&gt;&lt;SPAN class="hljs-attr"&gt;spec:&lt;/SPAN&gt;
  &lt;SPAN class="hljs-attr"&gt;serviceAccountName:&lt;/SPAN&gt; &lt;SPAN class="hljs-string"&gt;my-serviceaccount&lt;/SPAN&gt;
  &lt;SPAN class="hljs-attr"&gt;volumes:&lt;/SPAN&gt;
    &lt;SPAN class="hljs-bullet"&gt;-&lt;/SPAN&gt; &lt;SPAN class="hljs-attr"&gt;name:&lt;/SPAN&gt; &lt;SPAN class="hljs-string"&gt;azure-projected-service-account-token&lt;/SPAN&gt;
      &lt;SPAN class="hljs-attr"&gt;projected:&lt;/SPAN&gt;
        &lt;SPAN class="hljs-attr"&gt;sources:&lt;/SPAN&gt;
          &lt;SPAN class="hljs-bullet"&gt;-&lt;/SPAN&gt; &lt;SPAN class="hljs-attr"&gt;serviceAccountToken:&lt;/SPAN&gt;
              &lt;SPAN class="hljs-attr"&gt;audience:&lt;/SPAN&gt; &lt;SPAN class="hljs-string"&gt;api://AzureADTokenExchange&lt;/SPAN&gt;
              &lt;SPAN class="hljs-attr"&gt;expirationSeconds:&lt;/SPAN&gt; &lt;SPAN class="hljs-number"&gt;3600&lt;/SPAN&gt;
              &lt;SPAN class="hljs-attr"&gt;path:&lt;/SPAN&gt; &lt;SPAN class="hljs-string"&gt;azure-projected-service-account-token&lt;/SPAN&gt;
  &lt;SPAN class="hljs-attr"&gt;containers:&lt;/SPAN&gt;
    &lt;SPAN class="hljs-bullet"&gt;-&lt;/SPAN&gt; &lt;SPAN class="hljs-attr"&gt;name:&lt;/SPAN&gt; &lt;SPAN class="hljs-string"&gt;my-container&lt;/SPAN&gt;
      &lt;SPAN class="hljs-attr"&gt;volumeMounts:&lt;/SPAN&gt;
        &lt;SPAN class="hljs-bullet"&gt;-&lt;/SPAN&gt; &lt;SPAN class="hljs-attr"&gt;mountPath:&lt;/SPAN&gt; &lt;SPAN class="hljs-string"&gt;/databricks/secrets/azure-projected-service-account-token&lt;/SPAN&gt;
          &lt;SPAN class="hljs-attr"&gt;name:&lt;/SPAN&gt; &lt;SPAN class="hljs-string"&gt;azure-projected-service-account-token&lt;/SPAN&gt;
          &lt;SPAN class="hljs-attr"&gt;readOnly:&lt;/SPAN&gt; &lt;SPAN class="hljs-literal"&gt;true&lt;/SPAN&gt;
      &lt;SPAN class="hljs-attr"&gt;env:&lt;/SPAN&gt;
        &lt;SPAN class="hljs-bullet"&gt;-&lt;/SPAN&gt; &lt;SPAN class="hljs-attr"&gt;name:&lt;/SPAN&gt; &lt;SPAN class="hljs-string"&gt;AZURE_CLIENT_ID&lt;/SPAN&gt;
          &lt;SPAN class="hljs-attr"&gt;value:&lt;/SPAN&gt; &lt;SPAN class="hljs-string"&gt;&amp;lt;client-id&amp;gt;&lt;/SPAN&gt;
        &lt;SPAN class="hljs-bullet"&gt;-&lt;/SPAN&gt; &lt;SPAN class="hljs-attr"&gt;name:&lt;/SPAN&gt; &lt;SPAN class="hljs-string"&gt;AZURE_TENANT_ID&lt;/SPAN&gt;
          &lt;SPAN class="hljs-attr"&gt;value:&lt;/SPAN&gt; &lt;SPAN class="hljs-string"&gt;&amp;lt;tenant&amp;gt;&lt;/SPAN&gt;
        &lt;SPAN class="hljs-bullet"&gt;-&lt;/SPAN&gt; &lt;SPAN class="hljs-attr"&gt;name:&lt;/SPAN&gt; &lt;SPAN class="hljs-string"&gt;AZURE_AUTHORITY_HOST&lt;/SPAN&gt;
          &lt;SPAN class="hljs-attr"&gt;value:&lt;/SPAN&gt; &lt;SPAN class="hljs-string"&gt;"https://login.microsoftonline.com/"&lt;/SPAN&gt;
        &lt;SPAN class="hljs-bullet"&gt;-&lt;/SPAN&gt; &lt;SPAN class="hljs-attr"&gt;name:&lt;/SPAN&gt; &lt;SPAN class="hljs-string"&gt;AZURE_FEDERATED_TOKEN_FILE&lt;/SPAN&gt;
          &lt;SPAN class="hljs-attr"&gt;value:&lt;/SPAN&gt; &lt;SPAN class="hljs-string"&gt;"/databricks/secrets/azure-projected-service-account-token/azure-projected-service-account-token"&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;UL class="qt3gz97 qt3gz92"&gt;
&lt;LI class="qt3gz9a"&gt;The Databricks SDK/CLI will look for &lt;CODE class="qt3gz9f"&gt;AZURE_FEDERATED_TOKEN_FILE&lt;/CODE&gt;, perform the token exchange, and obtain a Databricks OAuth token.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P class="_7uu25p0 qt3gz9c _7pq7t612 heading3 _7uu25p1"&gt;&lt;U&gt;Databricks Token Federation vs. OAuth m2m Flow&lt;/U&gt;&lt;/P&gt;
&lt;P class="_7uu25p0 qt3gz9c _7pq7t612 heading4 _7uu25p1"&gt;&lt;EM&gt;Workload Identity Federation (What you configure here)&lt;/EM&gt;&lt;/P&gt;
&lt;UL class="qt3gz97 qt3gz92"&gt;
&lt;LI class="qt3gz9a"&gt;The &lt;EM&gt;workload&lt;/EM&gt; (your application in a pod) obtains a federated (OIDC) token (from Kubernetes/Azure), then exchanges it for a short-lived Databricks OAuth token via the Databricks federation endpoint.&lt;/LI&gt;
&lt;LI class="qt3gz9a"&gt;No long-lived client secrets or tokens are managed or injected by Databricks.&lt;/LI&gt;
&lt;LI class="qt3gz9a"&gt;This model is more secure and easier to operate at scale (automatic rotation, least privilege, reduced secret sprawl).&amp;nbsp;&lt;A href="https://docs.databricks.com/aws/en/dev-tools/auth/oauth-federation" target="_blank"&gt;https://docs.databricks.com/aws/en/dev-tools/auth/oauth-federation&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P class="_7uu25p0 qt3gz9c _7pq7t612 heading4 _7uu25p1"&gt;&lt;EM&gt;OAuth m2m (Machine-to-Machine) Flow&lt;/EM&gt;&lt;/P&gt;
&lt;UL class="qt3gz97 qt3gz92"&gt;
&lt;LI class="qt3gz9a"&gt;Typically, the service (machine) uses a client_id and client_secret pre-shared with Databricks to obtain tokens.&lt;/LI&gt;
&lt;LI class="qt3gz9a"&gt;Secrets must be managed, rotated, and injected into workloads (increasing risk if leaked).&lt;/LI&gt;
&lt;LI class="qt3gz9a"&gt;Not as dynamic or tightly scoped as workload identity federation.&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Tue, 16 Sep 2025 14:58:04 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/databricks-service-principal-token-federation-on-kubernetes/m-p/132131#M4053</guid>
      <dc:creator>sarahbhord</dc:creator>
      <dc:date>2025-09-16T14:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks service principal token federation on Kubernetes</title>
      <link>https://community.databricks.com/t5/administration-architecture/databricks-service-principal-token-federation-on-kubernetes/m-p/132949#M4092</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/126682"&gt;@sparkplug&lt;/a&gt;, just checking in, did the guidance shared above help address your query? If it did, please consider marking it as the accepted answer.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Sep 2025 14:30:24 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/databricks-service-principal-token-federation-on-kubernetes/m-p/132949#M4092</guid>
      <dc:creator>Advika</dc:creator>
      <dc:date>2025-09-24T14:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks service principal token federation on Kubernetes</title>
      <link>https://community.databricks.com/t5/administration-architecture/databricks-service-principal-token-federation-on-kubernetes/m-p/134696#M4199</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/143567"&gt;@sarahbhord&lt;/a&gt;&amp;nbsp;Isn't it the same federation policy that I would configure on Azure as a service principal as well ? Given that I will always use Azure service principal or managed identity.&lt;/P&gt;&lt;P&gt;I am not able to make the databricks-sdk pick up on the environment variables , but it constantly complaints that there is no default auth set&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;ValueError: default auth: cannot configure default credentials, please check &lt;A href="https://docs.databricks.com/en/dev-tools/auth.html#databricks-client-unified-authentication" target="_blank"&gt;https://docs.databricks.com/en/dev-tools/auth.html#databricks-client-unified-authentication&lt;/A&gt; to configure credentials for your preferred authentication method.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Oct 2025 09:06:53 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/databricks-service-principal-token-federation-on-kubernetes/m-p/134696#M4199</guid>
      <dc:creator>sparkplug</dc:creator>
      <dc:date>2025-10-13T09:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks service principal token federation on Kubernetes</title>
      <link>https://community.databricks.com/t5/administration-architecture/databricks-service-principal-token-federation-on-kubernetes/m-p/134698#M4200</link>
      <description>&lt;P&gt;I am currently using a two step process, logging in using azure library and then getting an access token from Azure using the databricks scope. And then using that to authorize towards Databricks. I would like to use `env-oidc` auth type instead, but it doesn't seem to work. Not sure if it's trying to write .databrickscfg . And am not sure how the token refresh is handled in the sdk&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;from databricks.sdk import WorkspaceClient&lt;BR /&gt;from azure.identity import WorkloadIdentityCredential&lt;BR /&gt;&lt;BR /&gt;credential = WorkloadIdentityCredential(client_id=os.environ["APPLICATION_ID"])&lt;BR /&gt;token = credential.get_token(DATABRICKS_SCOPE).token&lt;BR /&gt;return WorkspaceClient(host=os.environ["DATABRICKS_HOST"], token=token)&lt;/P&gt;&lt;P&gt;I am using&lt;BR /&gt;databricks-sdk==0.67.0&lt;BR /&gt;azure-identity==1.25.0&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Any suggestions are appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Oct 2025 09:23:02 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/databricks-service-principal-token-federation-on-kubernetes/m-p/134698#M4200</guid>
      <dc:creator>sparkplug</dc:creator>
      <dc:date>2025-10-13T09:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks service principal token federation on Kubernetes</title>
      <link>https://community.databricks.com/t5/administration-architecture/databricks-service-principal-token-federation-on-kubernetes/m-p/134757#M4203</link>
      <description>&lt;P&gt;Gotcha. Can you describe what is not working? Any specific error or behaviour?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Oct 2025 14:25:23 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/databricks-service-principal-token-federation-on-kubernetes/m-p/134757#M4203</guid>
      <dc:creator>sarahbhord</dc:creator>
      <dc:date>2025-10-13T14:25:23Z</dc:date>
    </item>
  </channel>
</rss>

