Use Databricks data on Microsoft Power Platform
This feature is in Public Preview.
This page explains how to use your Databricks data from the following platforms after creating a connection:
- Power Apps: Build applications that can read from and write to Databricks, while preserving your Databricks governance controls.
- Power Automate: Build flows and add actions that enable executing custom SQL or an existing Job and get back the results.
- Copilot Studio: Build custom agents using your Databricks data as a knowledge source or connect Genie spaces as tools.
Prerequisites
Before you connect to Databricks from Power Platform, you must create a connection to Databricks on Microsoft Power Platform.
Use your Databricks data to build Power canvas apps
To add your Databricks data to your application, do the following:
- From the leftmost navigation bar in Power Apps, click Create.
- Click Start with a blank canvas and choose your desired canvas size to create a new canvas app.
- From your application, click Add data > Connectors > Databricks. Click the Databricks connection you created.
- Select a catalog from the Choose a dataset sidebar.
- From the Choose a dataset sidebar, select all the tables you want to connect your canvas app to.
- Click Connect.
Data operations in Power Apps:
The connector supports create, update, and delete operations, but only for tables that have a primary key defined. When performing create operations you must always specify the primary key.
Databricks supports generated identity columns. In this case, primary key values are automatically generated on the server during row creation and cannot be manually specified.
Use your Databricks data to build Power Automate flows
The Databricks Statement Execution API and Jobs API are exposed within Power Automate, allowing you to write SQL statements and run existing Jobs. To create a Power Automate flow using Databricks as an action, do the following:
-
From the leftmost navigation bar in Power Automate, click Create.
-
Create a flow and add any trigger type.
-
From your new flow, click + and search for "Databricks" to see the available actions.
-
To write a SQL query, select one of the following actions:
-
Execute a SQL Statement: Write and run a SQL statement. Enter the following:
- For Body/warehouse_id, enter the ID of the warehouse upon which to execute the SQL statement.
- For Body/statement_id, enter the ID of the SQL statement to execute.
For more about advanced parameters, see the API documentation.
-
Check status and get results: Check the status of a SQL statement and gather results. Enter the following:
- For Statement ID, enter the ID returned when the SQL statement was executed.
For more about the parameter, see the API documentation.
-
Cancel the execution of a statement: Terminate execution of a SQL statement. Enter the following:
- For Statement ID, enter the ID of the SQL statement to terminate.
For more about the parameter, see the API documentation.
-
Get result by chunk index: Get results by chunk index, which is suitable for large result sets. Enter the following:
- For Statement ID, enter the ID of the SQL statement whose results you want to retrieve.
- For Chunk index, enter the target chunk index.
For more about the parameters, see the API documentation.
-
-
To interact with an existing Databricks Job, select one of the following actions:
- List jobs: Retrieves a list of jobs. For more information, see the API documentation.
- Trigger a new job run: Runs a job and returns the
run_idof the triggered run. For more information, see the API documentation. - Get a single job run: Returns metadata about a run, including run status (e.g.,
RUNNING,SUCCESS,FAILED), start and end time, run durations, cluster information, and so on. For more information, see the API documentation. - Cancel a run: Cancels a job run or a task run. For more information, see the API documentation.
- Get the output for a single run: Retrieves the output and metadata of a single job or task run. For more information, see the API documentation.
Connect to Genie spaces in Copilot Studio
Before using this feature, do the following:
- Enable the Managed MCP Servers preview in your workspace. See Manage Databricks previews.
- Create a connection to Databricks in Power Apps. See Create a Databricks connection on Microsoft Power Platform.
AI/BI Genie is a Databricks feature that allows business teams to interact with their data using natural language. For more information about setting up Genie spaces on Databricks, see What is an AI/BI Genie space. Make sure to provide your Databricks Genie space a clear name and description.
To add a Genie space as a tool in a Copilot Studio agent, do the following:
-
From the Copilot Studio sidebar, click Agent.
-
Select an existing agent or create a new agent by clicking + Create blank agent.
-
Select your agent's model. Databricks recommends selecting Sonnet 4.5 as your agent's model.
-
Under Instructions, describe your agent's capabilities and how it should behave.
- Databricks recommends including the following in the instructions: “Always continue polling the Genie space until you receive a response. Do not stop after a few seconds.” This prevents the integration from repeatedly sending a "still processing" message while the agent is polling the Genie space.
-
Under Tools, click + Add a Tool.
-
Search for "Databricks" or select Model Context Protocol.
-
Select Databricks Genie, choose your connection to Databricks next to Connection, and click Add and configure.
-
Configure the Databricks Genie tool:
- Name the tool. A more descriptive tool name helps the Copilot Studio agent orchestrate requests.
- Under Inputs, enter the Genie Space ID or select the Genie space from the dropdown menu.
- Save the tool.
- (Optional) Refresh the tools section in the configuration screen to confirm that the Genie space is connected.
-
In the upper-right, click Settings. Under the Orchestration section, click Yes to use generative AI orchestration for your agent's responses.
-
To publish your agent, click Publish in the upper-right.
-
(Optional) Publish the Genie-enabled Copilot Studio agent to Microsoft Teams or Microsoft 365 to distribute Genie's insights to other users. To learn how to publish your agent, see Microsoft's documentation.
You can add your agent to a Power App. To set up a Power App, see Use your Databricks data to build Power canvas apps. To add your Copilot Studio agent to a Power App, see Microsoft's documentation.
To use the agent in your published app, open the published application, click the Copilot icon in the top right corner, and ask a question.
Use Databricks as a knowledge source in Copilot Studio
To add your Databricks data as a knowledge source to a Copilot Studio agent, do the following:
-
From the Copilot Studio sidebar, click Agent.
-
Select an existing agent or create a new agent by clicking + New agent.
- Describe the agent by inputting a message and then click Create.
- Or, click Skip to manually specify the agent’s information.
-
In the Knowledge tab, click + Knowledge.
-
Click Advanced.
-
Click Databricks as the knowledge source.
-
Input the catalog name your data is in.
-
Click Connect.
-
Select the tables you want your agent to use as a knowledge source and click Add.
Conduct batch updates
If you need to perform bulk create, update, or delete operations in response to Power Apps inputs, Databricks recommends to implement a Power Automate flow. To accomplish this, do the following:
-
Create a canvas app using your Databricks connection in Power Apps.
-
Create a Power Automate flow using the Databricks connection and use Power Apps as the trigger.
-
In the Power Automate trigger, add the input fields that you want to pass from Power Apps to Power Automate.
-
Create a collection object within Power Apps to collect all of your changes.
-
Add the Power Automate flow to your canvas app.
-
Call the Power Automate flow from your canvas app and iterate over the collection using a
ForAllcommand.SQLForAll(collectionName, FlowName.Run(input field 1, input field 2, input field 3, …)
Concurrent writes
Row-level concurrency reduces conflicts between concurrent write operations by detecting changes at the row-level and automatically resolving conflicts that occur when concurrent writes update or delete different rows in the same data file.
Row-level concurrency is included in Databricks Runtime 14.2 or above. Row-level concurrency is supported by default for the following types of tables:
- Tables with deletion vectors enabled and without partitioning
- Tables with liquid clustering, unless deletion vectors are disabled
To enable deletion vectors, run the following SQL command.
ALTER TABLE table_name SET TBLPROPERTIES ('delta.enableDeletionVectors' = true);
For more information about concurrent write conflicts in Databricks, see Isolation levels and write conflicts on Databricks.
Limitations
Copilot Studio limitations
- Genie spaces in Copilot Studio support up to five questions per minute due to Genie API rate limits.
Power Apps limitations
The following PowerFx formulas calculate values using only the data retrieved locally:
Category | Formula |
|---|---|
Table function |
|
Aggregation |
|