<?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: Using Genie Conversational API with External Users and Data-Level Security in Generative AI</title>
    <link>https://community.databricks.com/t5/generative-ai/using-genie-conversational-api-with-external-users-and-data/m-p/134663#M1220</link>
    <description>&lt;P&gt;Really appreciate your time and support!&lt;/P&gt;</description>
    <pubDate>Sun, 12 Oct 2025 12:46:41 GMT</pubDate>
    <dc:creator>JohnnyA</dc:creator>
    <dc:date>2025-10-12T12:46:41Z</dc:date>
    <item>
      <title>Using Genie Conversational API with External Users and Data-Level Security</title>
      <link>https://community.databricks.com/t5/generative-ai/using-genie-conversational-api-with-external-users-and-data/m-p/134463#M1205</link>
      <description>&lt;P&gt;&lt;SPAN&gt;We are planning to implement a chat interface in our portal application using the Genie Conversational API, where clients, partners, and internal users can ask questions in natural language and receive answers based on our data.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I have the following questions:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1. Authentication and Authorization for External Users&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;We don't want to create Databricks accounts for our clients and partners. Is there a way to pass a user identifier through the Conversational API that would allow us to programmatically enforce access controls? Specifically, we need to verify whether external users have permission to access specific tables and data without them having direct Databricks credentials.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2. Row-Level Security / Data Filtering&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Our clients and partners have different data access levels (row-level permissions). Is there a mechanism within Genie to apply data filters based on the authenticated user before processing queries? For example:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Partner A should only see records related to their organization&lt;/LI&gt;&lt;LI&gt;Client B should only access their specific subset of data&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;How can we ensure Genie respects these data-level permissions when generating responses?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;3. Limiting Genie's Response Scope&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Currently, Genie answers generic questions outside our business domain, even with system-level instructions configured. For example, it will respond to questions like "What is the weather in Chicago?"&lt;/P&gt;&lt;P&gt;Is there a way to restrict Genie to only answer questions related to our specific data and business context, and politely decline or redirect out-of-scope queries?&lt;BR /&gt;&lt;BR /&gt;We tried system-level instruction in the genie space, but it didn't work out.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Oct 2025 20:01:54 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/using-genie-conversational-api-with-external-users-and-data/m-p/134463#M1205</guid>
      <dc:creator>JohnnyA</dc:creator>
      <dc:date>2025-10-09T20:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: Using Genie Conversational API with External Users and Data-Level Security</title>
      <link>https://community.databricks.com/t5/generative-ai/using-genie-conversational-api-with-external-users-and-data/m-p/134618#M1218</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/190100"&gt;@JohnnyA&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I'll try to explain ideas and hope something works for you because I don't have the whole context.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;H4&gt;1) Authentication &amp;amp; authorization for external users&lt;/H4&gt;&lt;P class=""&gt;&lt;STRONG&gt;Recommended (best practice):&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;STRONG&gt;Federated identity + OBO.&lt;/STRONG&gt;&lt;/SPAN&gt; Your portal authenticates with your IdP (Entra/Okta, etc.), exchanges the IdP token for a Databricks OAuth token, and your backend calls the &lt;SPAN class=""&gt;&lt;STRONG&gt;Genie Conversation API&lt;/STRONG&gt;&lt;/SPAN&gt; or SQL &lt;SPAN class=""&gt;&lt;STRONG&gt;on behalf of the user&lt;/STRONG&gt;&lt;/SPAN&gt;. Result: per-user permissions, fine-grained audit, and least privilege—without creating manual accounts or issuing PATs to clients.&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Alternative:&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;Run with a &lt;SPAN class=""&gt;&lt;STRONG&gt;Service Principal&lt;/STRONG&gt;&lt;/SPAN&gt; (least privilege) and isolate each tenant with views/policies (or&amp;nbsp; e.g one SP per partner). This is simpler operationally but &lt;SPAN class=""&gt;&lt;STRONG&gt;loses per-user traceability&lt;/STRONG&gt;&lt;/SPAN&gt; and scales worse.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;H4&gt;&lt;STRONG&gt;2) Row-level security / per-user filtering&lt;/STRONG&gt;&lt;/H4&gt;&lt;P class=""&gt;Enforce security &lt;SPAN class=""&gt;&lt;STRONG&gt;in the data layer&lt;/STRONG&gt;&lt;/SPAN&gt;, not in prompts:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;STRONG&gt;Row filters&lt;/STRONG&gt;&lt;/SPAN&gt; (row-level filtering) and &lt;SPAN class=""&gt;&lt;STRONG&gt;column masks&lt;/STRONG&gt;&lt;/SPAN&gt; (column-level masking) in Unity Catalog. Policies evaluate the &lt;SPAN class=""&gt;&lt;STRONG&gt;current user&lt;/STRONG&gt;&lt;/SPAN&gt; at read time.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;STRONG&gt;ABAC via governed tags:&lt;/STRONG&gt;&lt;/SPAN&gt; tag columns/objects (tenant, sensitivity, role) and define policies by attributes—this scales better than one-off rules.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;STRONG&gt;Dynamic views&lt;/STRONG&gt;&lt;/SPAN&gt; for logic spanning multiple tables (handy for partners/clients with complex rules).&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P class=""&gt;Genie will generate SQL against these tables and &lt;SPAN class=""&gt;&lt;STRONG&gt;Unity Catalog will enforce&lt;/STRONG&gt;&lt;/SPAN&gt; the policies automatically.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;H4&gt;&lt;STRONG&gt;3) Restrict Genie to your business domain&lt;/STRONG&gt;&lt;/H4&gt;&lt;P class=""&gt;&lt;STRONG&gt;Observed behavior (real test):&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;In a curated Space with a small set of tables (e.g., a single &lt;I&gt;sales&lt;/I&gt; table), asking an off-topic question like “What’s the weather in Madrid?” yielded a refusal along the lines of:&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;“Your question is irrelevant to the provided database, as it does not contain information about the weather or temperatures in Madrid. Please ask questions related to the data available in the customers_orders table.”&lt;/EM&gt;&lt;/P&gt;&lt;P class=""&gt;In practice, when the Space is tight (few tables, strong instructions, example queries), I haven’t been able to force Genie to leave the Space’s domain.&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;How to make this reliable in production:&lt;/STRONG&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;STRONG&gt;Curate the Space:&lt;/STRONG&gt;&lt;/SPAN&gt; keep &lt;SPAN class=""&gt;&lt;STRONG&gt;very few&lt;/STRONG&gt;&lt;/SPAN&gt; tables/views, add clear instructions (“only answer using the provided datasets”), and include &lt;SPAN class=""&gt;&lt;STRONG&gt;example queries&lt;/STRONG&gt;&lt;/SPAN&gt;. Always call the API with the correct &lt;SPAN class=""&gt;&lt;STRONG&gt;space_id&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;STRONG&gt;Portal “firewall”:&lt;/STRONG&gt;&lt;/SPAN&gt; before invoking Genie, run a simple in-scope check. If a question doesn’t map to your domain (no match to metrics/tables/terms), &lt;SPAN class=""&gt;&lt;STRONG&gt;don’t&lt;/STRONG&gt;&lt;/SPAN&gt; call Genie. Return a friendly message:&lt;/P&gt;&lt;P class=""&gt;&lt;I&gt;“I can only answer questions about &lt;/I&gt;&lt;SPAN class=""&gt;&lt;I&gt;&amp;lt;your datasets&amp;gt;&lt;/I&gt;&lt;/SPAN&gt;&lt;I&gt;. Try asking about &lt;/I&gt;&lt;SPAN class=""&gt;&lt;I&gt;&amp;lt;examples&amp;gt;&lt;/I&gt;&lt;/SPAN&gt;&lt;I&gt;.”&lt;/I&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P class=""&gt;Example: user asks &lt;I&gt;“Give me sales for 20189.”&lt;/I&gt; Genie might not know if “20189” is a typo for a &lt;SPAN class=""&gt;&lt;STRONG&gt;year&lt;/STRONG&gt;&lt;/SPAN&gt; (2018/2019) or a &lt;SPAN class=""&gt;&lt;STRONG&gt;product ID&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;Your pre-rewrite can use business rules (e.g., sales exist only 2019–2025; product IDs follow &lt;SPAN class=""&gt;aaaaa-bbbb-cc&lt;/SPAN&gt;) to produce a cleaner prompt or to route to the right Space.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;This improves answer quality when users lack data/Genie context, at the cost of a small extra step in your backend.&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;(Optional) Pre-rewrite for clarity (LLM pass in your portal):&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;Add a lightweight LLM step that reformulates the user’s question &lt;SPAN class=""&gt;&lt;STRONG&gt;without changing intent&lt;/STRONG&gt;&lt;/SPAN&gt;, just to resolve ambiguity and align to your schema/terms.&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Hope this helps, &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Isi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Oct 2025 07:53:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/using-genie-conversational-api-with-external-users-and-data/m-p/134618#M1218</guid>
      <dc:creator>Isi</dc:creator>
      <dc:date>2025-10-11T07:53:43Z</dc:date>
    </item>
    <item>
      <title>Re: Using Genie Conversational API with External Users and Data-Level Security</title>
      <link>https://community.databricks.com/t5/generative-ai/using-genie-conversational-api-with-external-users-and-data/m-p/134663#M1220</link>
      <description>&lt;P&gt;Really appreciate your time and support!&lt;/P&gt;</description>
      <pubDate>Sun, 12 Oct 2025 12:46:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/using-genie-conversational-api-with-external-users-and-data/m-p/134663#M1220</guid>
      <dc:creator>JohnnyA</dc:creator>
      <dc:date>2025-10-12T12:46:41Z</dc:date>
    </item>
  </channel>
</rss>

