<?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: MLFlow Authentication from Databricks App for GenAI Tracing in Generative AI</title>
    <link>https://community.databricks.com/t5/generative-ai/mlflow-authentication-from-databricks-app-for-genai-tracing/m-p/117393#M859</link>
    <description>&lt;P&gt;Ah I've seen this issue many times. The databricks sdk here is trying to authenticate with Databricks API but the environment variables are set for multiple types of authentication. If you remove the&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATABRICKS_CLIENT_ID, DATABRICKS_CLIENT_SECRET,&lt;/PRE&gt;&lt;P&gt;environment variables then I think you should get past that error. Let me know if there are any other issues after that fix is attempted!&lt;/P&gt;</description>
    <pubDate>Thu, 01 May 2025 14:07:52 GMT</pubDate>
    <dc:creator>samshifflett46</dc:creator>
    <dc:date>2025-05-01T14:07:52Z</dc:date>
    <item>
      <title>MLFlow Authentication from Databricks App for GenAI Tracing</title>
      <link>https://community.databricks.com/t5/generative-ai/mlflow-authentication-from-databricks-app-for-genai-tracing/m-p/117035#M856</link>
      <description>&lt;P&gt;I am working on a Dash-based app that includes a call to a Databricks-hosted LLM endpoint. I am trying to track those calls with MLFlow. My code is (roughly) like this:&lt;/P&gt;&lt;PRE&gt;from openai import OpenAI&lt;BR /&gt;import mlflow&lt;BR /&gt;&lt;BR /&gt;mlflow.set_tracking_uri("databricks")&lt;BR /&gt;mlflow.set_experiment("/Users/my-name@mycompany.com/my-experiment")&lt;BR /&gt;mlflow.openai.autolog()&lt;BR /&gt;&lt;BR /&gt;client = OpenAI()&lt;/PRE&gt;&lt;P&gt;This works as expected when testing the app locally, but results in an authentication error when deployed to Databricks apps. Specifically, if I turn on debug logging I see this error before the app crashes:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;DEBUG:urllib3.connectionpool:https://[MY WORKSPACE].databricks.com:443 "GET /api/2.0/mlflow/experiments/get-by-name?experiment_name=%2FUsers%2Fmy-name%40mycompany.com%2Fmy-experiment HTTP/1.1" 401 144&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;I have attempted the following (unsuccessfully):&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Manually setting the tracking URI to the specific URI for my workspace.&lt;/LI&gt;&lt;LI&gt;Setting the DATABRICKS_TOKEN environment variable to DATABRICKS_CLIENT_SECRET from the app's environment.&lt;/LI&gt;&lt;LI&gt;Setting the DATABRICKS_TOKEN to the value of a PAT I generated for the app.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;What is the correct way to capture GenAI traces with MLFlow from within a Databricks App deployment?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Apr 2025 20:49:24 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/mlflow-authentication-from-databricks-app-for-genai-tracing/m-p/117035#M856</guid>
      <dc:creator>pemidexx</dc:creator>
      <dc:date>2025-04-29T20:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: MLFlow Authentication from Databricks App for GenAI Tracing</title>
      <link>https://community.databricks.com/t5/generative-ai/mlflow-authentication-from-databricks-app-for-genai-tracing/m-p/117049#M857</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/120181"&gt;@pemidexx&lt;/a&gt;,&amp;nbsp;this may be a dumb question, but have you set your DATABRICKS_HOST env variable?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;os.environ["DATABRICKS_HOST"] = "https://dbc-1234567890123456.cloud.databricks.com" # set to your server URI
os.environ["DATABRICKS_TOKEN"] = "dapixxxxxxxxxxxxx"

mlflow.set_tracking_uri("databricks")
mlflow.set_experiment("/your-experiment")&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 30 Apr 2025 00:27:26 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/mlflow-authentication-from-databricks-app-for-genai-tracing/m-p/117049#M857</guid>
      <dc:creator>samshifflett46</dc:creator>
      <dc:date>2025-04-30T00:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: MLFlow Authentication from Databricks App for GenAI Tracing</title>
      <link>https://community.databricks.com/t5/generative-ai/mlflow-authentication-from-databricks-app-for-genai-tracing/m-p/117385#M858</link>
      <description>&lt;P&gt;Good question - unfortunately yes, if I set DATABRICKS_TOKEN I get a different error&lt;/P&gt;&lt;LI-CODE lang="python"&gt;2025/05/01 13:27:40 DEBUG mlflow.utils.databricks_utils: Failed to create databricks SDK workspace client, error: ValueError('validate: more than one authorization method configured: oauth and pat. Config: host=https://myworkspace.cloud.databricks.com, REDACTED_SECRET client_id=MYCLIENTID, client_REDACTED_SECRET warehouse_id=MYWAREHOUSE. Env: DATABRICKS_HOST, DATABRICKS_TOKEN, DATABRICKS_CLIENT_ID, DATABRICKS_CLIENT_SECRET, DATABRICKS_WAREHOUSE_ID')&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 01 May 2025 13:31:10 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/mlflow-authentication-from-databricks-app-for-genai-tracing/m-p/117385#M858</guid>
      <dc:creator>pemidexx</dc:creator>
      <dc:date>2025-05-01T13:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: MLFlow Authentication from Databricks App for GenAI Tracing</title>
      <link>https://community.databricks.com/t5/generative-ai/mlflow-authentication-from-databricks-app-for-genai-tracing/m-p/117393#M859</link>
      <description>&lt;P&gt;Ah I've seen this issue many times. The databricks sdk here is trying to authenticate with Databricks API but the environment variables are set for multiple types of authentication. If you remove the&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATABRICKS_CLIENT_ID, DATABRICKS_CLIENT_SECRET,&lt;/PRE&gt;&lt;P&gt;environment variables then I think you should get past that error. Let me know if there are any other issues after that fix is attempted!&lt;/P&gt;</description>
      <pubDate>Thu, 01 May 2025 14:07:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/mlflow-authentication-from-databricks-app-for-genai-tracing/m-p/117393#M859</guid>
      <dc:creator>samshifflett46</dc:creator>
      <dc:date>2025-05-01T14:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: MLFlow Authentication from Databricks App for GenAI Tracing</title>
      <link>https://community.databricks.com/t5/generative-ai/mlflow-authentication-from-databricks-app-for-genai-tracing/m-p/117435#M860</link>
      <description>&lt;P&gt;Thank you for the push in the right direction! I was able to solve the issue with this code&lt;/P&gt;&lt;LI-CODE lang="python"&gt;os.environ["DATABRICKS_CLIENT_ID"] = ""
os.environ["DATABRICKS_CLIENT_SECRET"] = ""
os.environ["DATABRICKS_TOKEN"] = os.environ.get("VAR_CONFIGURED_WITH_DATABRICKS_SECRETS")

# Enables trace logging by default
mlflow.set_tracking_uri("databricks")
mlflow.set_experiment("/Users/my-name@mycompany.com/my-experiment")
mlflow.openai.autolog()&lt;/LI-CODE&gt;&lt;P&gt;Note that I did not need to set DATABRICKS_HOST, as that's already set in the App's default environment.&lt;/P&gt;&lt;P&gt;Thanks &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/162707"&gt;@samshifflett46&lt;/a&gt; !&lt;/P&gt;</description>
      <pubDate>Thu, 01 May 2025 17:33:19 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/mlflow-authentication-from-databricks-app-for-genai-tracing/m-p/117435#M860</guid>
      <dc:creator>pemidexx</dc:creator>
      <dc:date>2025-05-01T17:33:19Z</dc:date>
    </item>
  </channel>
</rss>

