How to Run an Azure Databricks Notebook with Azure Data Factory

Integrating Azure Databricks notebooks with Azure Data Factory (ADF) involves several steps. The integration allows you to run Databricks notebooks as part of a data processing pipeline in ADF. Here’s a step-by-step guide on how to set this up, along with an example.

Step 1: Set Up Azure Databricks and Azure Data Factory

Azure Databricks Setup:

  1. Create an Azure Databricks Workspace if you don’t already have one.
    • Go to the Azure Portal.
    • Click “Create a resource”, search for “Azure Databricks”, and follow the prompts.

Azure Data Factory Setup:

  1. Create an Azure Data Factory Instance:
    • In the Azure Portal, click “Create a resource”, then find and select “Data Factory”.
    • Fill in the necessary details like name, region, resource group, and create it.

Step 2: Create a Databricks Notebook

  1. Navigate to your Azure Databricks Workspace and open it.
  2. Create a Notebook:
    • Go to the Workspace tab, click on “Create” and select “Notebook”.
    • Give the notebook a name, select a default language (e.g., Python, Scala, SQL), and click “Create”.
  3. Write your Notebook Code:
    • Add the necessary code that you want to run as part of your ADF pipeline.

Step 3: Integrate Databricks Notebook in Azure Data Factory Pipeline

  1. Open your Azure Data Factory Instance:
    • Go to the Azure Portal and navigate to your ADF instance.
    • Open the Author and Monitor tool.
  2. Create a new Pipeline:
    • In the ADF UI, go to the “Author” tab.
    • Click the “+” sign and select “Pipeline”.
  3. Add a Databricks Notebook Activity:
    • From the Activities pane, drag the “Databricks Notebook” activity into the pipeline canvas.
    • In the activity settings, configure the Databricks Notebook:
      • Linked Service: Set up a new or select an existing Databricks linked service. This requires the Databricks workspace URL and a personal access token.
      • Notebook Path: Specify the path to the notebook in your Databricks workspace.
  4. Configure Notebook Parameters (if applicable):
    • If your notebook accepts parameters, configure them in the “Base Parameters” section of the activity settings.
  5. Validate and Debug Pipeline:
    • Use the “Validate” option to check for any errors.
    • Use “Debug” to run the pipeline and ensure it executes as expected.
  6. Trigger the Pipeline:
    • Once validated, add a trigger to the pipeline—either scheduled or run-on-demand.

Example Notebook Code in Databricks

Here’s a simple example of what your Databricks notebook might contain:

# Python example
dbutils.notebook.exit("Hello World from Databricks Notebook")

This is a basic notebook that does nothing more than return a string. Real notebooks will likely involve data manipulation, processing, and writing results to a destination.

Step 4: Monitor and Manage

Once the pipeline is running, you can monitor its execution within the ADF environment:

  • Monitoring tab in ADF: Check the run outcomes, performance, and any errors or logs.

This integration enables complex data transformations and analyses within Databricks to be orchestrated as part of broader data workflow managed by Azure Data Factory, providing powerful capabilities for ETL, data processing, and analytics.

Related Posts

Databrick Serverless compute limitations

Here’s a simple, line-by-line summary of the Serverless compute limitations (09/29/2025): General limitations Streaming limitations Machine learning limitations Notebook limitations Job limitations Compute-specific limitations Caching limitations Hive…

Read More

Databrick Serverless compute release

Here’s a simple line-by-line summary of the important points from the Serverless Compute release notes (09/24/2025): Perfect 👍 Here’s a one-page cheat sheet table for the Serverless…

Read More

50 interview questions and answers for an Azure Databricks Platform Engineer

Here are 50 interview questions and answers for an Azure Databricks Platform Engineer, divided by skill level and covering key areas (core, advanced, and scenario-based): 🔹 Essential…

Read More

Optimize, ZORDER, and Vacuum in Databricks: What You Must Know

Optimize, ZORDER, and Vacuum in Databricks: What You Must Know In the world of big data, performance is everything. Databricks, with its powerful Delta Lake engine, offers…

Read More

Track and Optimize Your Databricks Costs with system.billing Tables in Unity Catalog

💰 Track and Optimize Your Databricks Costs with system.billing Tables in Unity Catalog Databricks has become a core component of many modern data stacks — but with…

Read More

Understanding system.access Tables in Unity Catalog (Azure Databricks)

🔍 Understanding system.access Tables in Unity Catalog (Azure Databricks) Databricks’ Unity Catalog provides a powerful centralized data governance solution. One of its key features is the system.access…

Read More
guest
0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x