Democratizing data starts with making insights easy and secure to access. With Databricks Genie, users can now talk to their data directly from the tools they already use: Teams, Slack, Confluence, or custom web apps. Whether you’re using our native Copilot Studio/Foundry integrations or building with the Genie Conversation APIs/SDK, Genie can now bring natural-language analytics into everyday workflows. Behind the scenes, OAuth can be applied to securely authenticate each user and enforce data access permissions.
Previously, we saw customers like The AA and Casas Bahia independently build their own Genie integrations into Microsoft Teams and internal apps. Our robust extensibility suite now makes this experience easier, faster and more scalable.
In this blog, we’ll walk through two common ways to roll out Genie with enterprise OAuth across your organization:
Ad-hoc data questions come up all the time during group conversations. With Databricks Genie’s native Copilot Studio integration, your users can now get answers the moment questions arise directly in Microsoft Teams. To leverage this integration, follow the steps below:
The first step in enabling Genie in Microsoft Teams is to Connect Azure Databricks to Power Platform (documentation). In your Microsoft Power Apps, click Connections and select Azure Databricks, or Databricks if you use AWS/GCP. Configure the following fields:
Next, you’ll connect your Genie space to Copilot Studio (documentation). Our integration handles all of the API and MCP logic so the connection can be made in just a few clicks.
In Copilot Studio, click Agents. Select “Create blank agent” to build a new standalone agent for a Genie space. If you want to bring Genie into an existing agent framework, you can also choose an existing Copilot Studio agent to add your Genie space to.
In your new agent, click ‘Tools’, click “Add a tool”. Select Azure Databricks Genie (or Databricks Genie for AWS/GCP) under the MCP section.
Now, you can select your desired Genie space and configure the connection details:
When you choose “End user credentials,” each person must sign into Databricks with their own account. To make this simpler, we suggest sharing Connection parameters (as described in the Microsoft documentation), so users don’t have to provide that information themselves. In practice, this simply means providing the server hostname and HTTP path, which ensures they authenticate to the exact Databricks workspace linked to the Genie space connected in your Copilot Studio agent.
Now that you have a Copilot Studio Agent that is connected to your Genie space, you can publish it to Teams.
You’re all set! Genie is now live in Microsoft Teams, delivering governed data insights the instant questions come up.
To see how end users are leveraging Genie in Microsoft Teams, see our customer stories.
Many organizations also want to embed Genie directly in their custom web apps, so users can ask questions in the tools they already use—for example, store managers could ask ad-hoc questions about their inventory directly in their existing sales terminal. With Genie Conversation APIs and Databricks OAuth, this is now possible.
Before building an integration between your web app and Genie, it’s important to decide what OAuth pattern you’ll use: User-to-Machine (U2M), Machine-to-Machine (M2M), or an On-Behalf-Of (OBO) model. Each approach aligns with a different type of application use case:
For the rest of this blog, we’ll focus on the first pattern for integrating with Genie: the OAuth U2M flow using Databricks’ built-in OAuth support.
NOTE: Databricks also supports OAuth token federation, which you can use to bring in tokens issued by your own identity provider and combine them with any of the methods described above for Genie access.
To securely connect your custom web app to Genie, start by registering it in your Databricks account. This step allows Databricks to securely issue user-scoped tokens for your app in later steps. Check out the product documentation to learn more.
In the Databricks Account Console, add a new OAuth connection and configure the following:
After saving this connection, Databricks will generate the following:
Store these credentials securely in your backend—they will be required to exchange authorization codes for access tokens and authenticate calls to the Genie Conversation APIs.
The next step is to make sure your app directs end users to Databricks so they can sign in and approve your app to talk to Genie on their behalf. After a successful login and approval, Databricks will redirect the user to your app with a short lived authorization code.
This authorization code is proof that the user successfully authenticated into Databricks, and the user has approved your app’s requested access. Your app’s backend will use this authorization code in the next step to obtain access tokens.
To start, generate PKCE and state values for each sign-in to protect your web application:
Next, your frontend should construct an authorization URL using the Databricks OAuth endpoint:
Include the following form parameters to identify your application for your users:
After a user signs into their Databricks account, they will be redirected to the redirect_url with query parameters: https://<redirect_url>/oauth/callback?code=<authorization_code>&state=<state>
Your callback handler should read the authorization_code and state from the query string. Verify the state value matches what was stored in cookies or web sessions. If it doesn’t discard the authorization_code. With the returned authorization_code, your application can now exchange them for access tokens.
The authorization code retrieved in the previous step cannot be used to call APIs directly—it must be exchanged for access tokens on your backend that are needed to securely talk to Genie. For more information please refer to our product documentation).
Below is a Python example for exchanging authorization codes for access and refresh tokens (see details in OAuth SDK documentation):
Include the following parameters:
It’s important to save the following values from the result object to your app’s database:
To securely manage access tokens, it’s also important that your app tracks expiration times and uses the refresh tokens to obtain new access tokens when needed. The code example below abstracts refresh logic away to always return a valid user access token:
Now that your application has user-scoped Databricks access tokens, it can submit prompts to a Genie space on behalf of the signed-in user. We recommend creating a backend API router for your web application to protect the Databricks access tokens from the browser and to centralize observability, error handling, and rate limiting. The code examples below leverage FastAPI and Genie’s SDK for simpler logic.
After these steps, your custom web app will be securely integrated with Genie, letting users ask natural-language questions and retrieve governed insights directly in the tools they already use.
Genie is designed to meet users wherever they work. In this blog, we covered how organizations securely embed Genie’s conversational analytics capabilities into Microsoft Teams and custom apps with OAuth authentication.
By bringing Genie everywhere your teams ask questions, you shorten the path from question to insight—and from insight to action. Start building Genie spaces and bringing them to your users today. As always, reach out to your Databricks account teams for questions and feedback.
Product
November 21, 2024/3 min read

