cancel
Showing results for 
Search instead for 
Did you mean: 
Technical Blog
Explore in-depth articles, tutorials, and insights on data analytics and machine learning in the Databricks Technical Blog. Stay updated on industry trends, best practices, and advanced techniques.
cancel
Showing results for 
Search instead for 
Did you mean: 
Kavya21
New Contributor III

A capability that often goes unnoticed in Databricks Workflows is the Power BI task type. After exploring this feature in detail, it becomes clear that a common challenge faced by many data teams can now be solved more efficiently: Power BI semantic models can be refreshed directly from Databricks pipelines. 

The Traditional Workflow: 

In most modern analytics architectures, data transformation is performed inside Databricks pipelines. Once the transformations are completed and tables are updated, the Power BI dataset refresh must usually be triggered separately. 

This refresh process is typically handled through: 

  • Scheduled refreshes inside Power BI 
  • External API calls 
  • Additional orchestration tools 

Although these approaches work, they introduce extra dependencies and operational complexity into the workflow. 

A Simpler Approach with the Power BI Task: 

The introduction of the Power BI task within Databricks Workflows simplifies this process significantly. 

Once a pipeline completes its data transformations, a Power BI task can be added directly to the workflow. The semantic model can then be refreshed automatically as part of the same pipeline execution. 

Because of this integration: 

  • External scripts are no longer required 
  • Refresh orchestration can be handled within Databricks itself 
  • Data engineering pipelines and BI refresh processes can be managed together 

This results in a more streamlined and unified data pipeline. 

Integration with Unity Catalog: 

Another key aspect of this feature is its native integration with Unity Catalog. 

Power BI semantic models can directly consume data objects stored in Unity Catalog, including: 

  • Tables 
  • Views 
  • Materialized views 
  • Streaming tables 

As a result, curated and governed datasets maintained in Databricks can be used directly as the foundation for Power BI semantic models. 

Even more flexibility is provided because data can be combined across multiple catalogs and schemas within Unity Catalog. This is particularly valuable in environments where data domains are distributed across multiple sources. 

Security and Governance: 

From a governance standpoint, the integration relies on Microsoft Entra ID authentication using OAuth and Single Sign-On (SSO). 

Because of this architecture: 

  • Unity Catalog permissions can be respected within Power BI queries. 
  • Access policies remain consistent across both platforms. 
  • Data governance rules are enforced throughout the analytics stack. 

This ensures that security controls remain centralized and consistent. 

Smarter Dataset Refresh: 

Another advantage of integrating Power BI refresh with Databricks workflows is that refresh operations can be triggered only when data changes occur. 

Instead of refreshing datasets on fixed schedules, refresh tasks can be executed after upstream data pipelines complete successfully. 

This approach can: 

  • Reduce unnecessary refresh operations. 
  • Improve pipeline efficiency. 
  • Ensure dashboards always reflect the most recent data. 

Orchestrating Power BI from Databricks: 

Although Power BI datasets can be published manually from Databricks, the Power BI task enables automatic orchestration of semantic models directly within workflows. 

Before configuring this integration, the same prerequisites required for manual publishing must be satisfied. 

Step 1: Preparing Authentication Credentials 

To allow Databricks to interact with Power BI, authentication credentials must first be prepared. 

Two authentication methods are supported: 

  • OAuth Machine-to-Machine 
  • OAuth User-to-Machine 

OAuth Machine-to-Machine Setup 

For machine-to-machine authentication, the following steps must be completed: 

  1. An Azure service principal must be created or an existing one must be used through the Azure portal. 
  2. The service principal must be added to the Power BI workspace where datasets are published. 
  3. Service principals must be enabled in the Power BI Admin Portal. 
  4. client secret must be generated, and both the client ID and client secret must be stored. 
  5. The authorization endpoint must be recorded, which follows this format:

https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/authorize. 

OAuth User-to-Machine Setup 

For user-based authentication, an authorization endpoint must also be obtained. 

The endpoint follows the same structure: 

https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/authorize 

Here, {tenant_id} represents the Microsoft Entra tenant associated with the organization. 

If the dataset resides inside My Workspace (personal workspace), the tenant ID can be replaced with: 

https://login.microsoftonline.com/common/oauth2/v2.0/authorize 

When the connection is created, a login window will be displayed. The user will sign in and grant access to an Entra application named: 

Databricks Dataset Publishing Integration 

This application enables Databricks to interact with Power BI resources on behalf of the user. 

Step 2: Creating a Power BI Connection in Unity Catalog: 

To orchestrate Power BI tasks, a connection must first be created inside Unity Catalog. 

Note: The CREATE CONNECTION privilege is required to create this connection. If it is created by another user, the USE CONNECTION privilege must be granted. 

  1. The Databricks workspace should be opened and Catalog Explorer should be accessed. 
  2. The Create → Create connection option should be selected.
    Kavya21_0-1778668173761.png
  3.  A connection name should be provided. 
  4.  The connection type should be set to Power BI. 
    Kavya21_1-1778668213552.png
  5. For Auth type, select OAuth Machine to Machine or OAuth (user to machine), based on the credentials you prepared previously and Click Next Kavya21_2-1778668289063.png
  6. In Step 2 of the Set up connection wizard, you are prompted for the credential information you prepared.Kavya21_5-1778668512373.png

     

  7. Login with your PowerBI workspace credentials. Kavya21_0-1778673174895.pngOnce successfully logged in you can create the connection 
  8. Click Create connection
    Kavya21_0-1779974241081.png
    Once the connection is created, the below page appears. This connection can now be used when configuring a Power BI task.   Kavya21_2-1778673434615.png

        If access needs to be shared with other users, the USE CONNECTION privilege can be granted. 

Step 3: Loading Data into Databricks: 

  1. Before refreshing a Power BI semantic model, a data ingestion or transformation job must be created in Databricks.
    Kavya21_1-1779974347523.png
    This job is responsible for: 
        i. Extracting data from the source system. 
        ii. Transforming the data. 
        iii. Loading it into curated tables within Databricks

  2. Once the data is prepared, Power BI dashboards can be built on top of these datasets.
    Kavya21_0-1779974667012.png

Step 4: Creating a Power BI Task in Databricks Jobs: 

To automate dataset refresh, a Power BI task must be added to a Databricks job workflow. 

  1. The Jobs UI should be opened. 
  2. Click + Add task. 
  3. Enter a Task name. 
  4. In the Type drop-down menu, select Power BI 
    Kavya21_1-1778674395608.png
  5. Once Power BI is selected, a Power BI connection must be chosen, the connection that was created earlier should be selected.

    Kavya21_2-1778674581461.png
     If a connection has not been created previously, click on the New Connection option and Step 2 should be followed to create the required connection.
    Kavya21_3-1778674598403.png
  6.  After selecting the connection, additional properties must be configured: 
    • The Power BI workspace containing the dashboardKavya21_9-1778674730887.png
    • The semantic model(dataset)
      Kavya21_10-1778674730888.png
    • The query mode 
      Kavya21_11-1778674730889.png
    • The tables that require refresh 

      Kavya21_12-1778674730891.png 
    • Select the Power BI task created earlier configured to depend on the upstream data loading job, ensuring the refresh only runs after data processing completes.Kavya21_13-1778674730891.png
  7. Click Save task.

Step 5: Triggering the Dataset Refresh:  

Once the workflow has been configured, the refresh process can be triggered. 

  1.  Click Run now, to trigger the refresh, the pipeline will execute the data transformation job first, followed by the Power BI task, which refreshes the semantic model automatically.
    Kavya21_0-1778681199598.png

As a result, the Power BI dataset in the workspace will be updated with the latest data generated by the pipeline. 

Final Thoughts: 

The Power BI task in Databricks represents an important step toward a fully integrated analytics architecture. 

Instead of managing data pipelines and BI refresh schedules separately, both processes can now be orchestrated within a single workflow. 

This integration simplifies pipeline management, improves data freshness, and reduces operational complexity. For teams already using Databricks for data engineering and Power BI for analytics, this feature can significantly streamline the end-to-end data workflow.

1 Comment
Abhilash_P
Databricks Partner

Good one @Kavya21 - No to depend on scheduled refresh in PBI service