In this post, I will walk you through the step-by-step process of creating a custom connector for Azure DataBricks.
I had a project where the biggest challenge was querying data bricks and bringing real-time data to a Power Apps Canvas Application.
I had a look at the available connectors in the Power Platform (https://learn.microsoft.com/en-us/connectors/connector-reference/connector-reference-powerapps-connectors)
Unfortunately, there was no connector for Microsoft Azure Data Bricks. So, I had to build one 😁.
Azure DataBricks exposes an API endpoint for all instances (unless you have deactivated it)
Your endpoint has the following format
https://YourTenantGuid.azuredatabricks.net/api/2.0/sql/statements/
This allows to send SQL queries and retrieve the results in different formats.
By default, the data is returned in a JSON array format.
Let’s get started !
First, navigate to your Power Apps platform (https://make.powerapps.com) and select Custom Connectors from the left-hand panel.
From the custom connectors page, click “+ New custom connector” > “Create from blank”
This will open the following wizard process:
In the first tab, provide a:
Click Security -> to move to the next section.
It is important to set the security method, this defines how you would authenticate and interact with Azure DataBricks.
An API key is recommended.
Make sure you set the following parameters:
Now, let’s define the action, which will be your custom connector’s action, which will be called in either PowerApps or Power Automate,
Click on the “New action” button from the left side, and provide the following details.
In this section, we will define how your request will look.
Let’s import the request’s definition from a sample, click on “Import from sample“, and provide the following JSON structure:
Content-Type: application-json
{ "warehouse_id": "xxxxxxxxxxx", "catalog": "xxxxxxxx", "schema": "xxxxxxxx", "statement": "your select statement for example select * from XY", "wait_timeout": "60s" }
Once you click import, your request’s structure will look like this:
At this stage, you can start testing your custom connector, or if you wish, you can lock specific parameters from being accidentally modified or provided the wrong values.
To do so, you can select the body and edit each individual parameter by changing its visibility and/or providing a static/default value.
It’s time to test your custom connector.
PS: Save your changes and update your connector before proceeding.
Navigate to the last step (6. Test), and the first thing you need to do is to create a connection which will be used for testing.
Once you click on “New connection”, you will see the following pop up:
Make sure to enter your API key in the following format:
Bearer [your key]
e.g. Bearer dapi111111111111111111111111111111
And click create.
Now, go back to your custom connector and navigate to the test section, you should see your connection in the dropdown.
Scroll down to the operations section, and provide your Azure Databricks warehouse ID, Catalog, Schema and SQL Statement
Click “Test operation“.
If you’ve followed all the steps previously explained, you should have a successful response (200).