User Data Function in Data Pipeline

In today’s data-driven world, speed and collaboration are everything. Data teams are expected to analyze, experiment, and deploy solutions faster than ever — without compromising quality. Microsoft Fabric introduces a powerful tool to support this mission: User Data Functions (UDFs).
Whether you’re building customer segments, performing churn analysis, or automating scoring models, UDFs help encapsulate logic into reusable, modular functions that anyone on the team can invoke — without having to rewrite a single line of complex logic.
User Data Functions (UDFs) are reusable PySpark-based logic blocks that can be defined once and used repeatedly across your analytics workflows. Think of them as building blocks for business logic that take well-defined inputs and return meaningful outputs — whether that’s a segment label, a score, or a transformed dataset.
These functions:
- Accept defined parameters (e.g., recency, frequency, score threshold).
- Contain embedded business logic (e.g., customer segmentation rules).
- Can be invoked on-demand in notebooks or through REST APIs.
Why UDF is a game changer
🔁 Define once and reuse many times across organisation.
🤝 Shared UDFs act as a single source of truth, ensuring consistency across teams and eliminating the risk of logic drift in analytics workflows
⚡ Instead of writing the same code again and again, you just call a ready-made function with one line
🌐 Access UDFs directly within notebooks or through REST APIs across your data ecosystem.
🚀 Designed for ease of use, even non-technical users can leverage advanced analytics without deep coding expertise.
UDFs can be embedded in:
- ETL/ELT pipelines (e.g., Azure Data Factory, Synapse Pipelines, Microsoft Fabric)
- Data transformation steps in PySpark
- Notebook-based development workflows
- Custom logic inside Power BI datasets
- REST APIs or web apps for real-time processing
What is Microsoft Fabric User Data Functions
It’s a collection of functions you can create for handling specific tasks that require custom code to help you manage your data efficiently by turning complex operations into reusable functions. You can use these functions across different datasets and workflows in the Fabric ecosystem. They also support data integration and deployment pipelines, making it easy to deploy and release your changes quickly. UDFs are serverless in nature and use a simple programming model, which reduces the time to code. By using Fabric capacity units, you only pay for what you use. You can integrate with data pipelines in Fabric notebooks for advanced analytical solutions. You can also enhance your Power BI reports to make them more dynamic with real-time data updates.
Why use Microsoft Fabric User Data Functions?
Fabric User data functions provides a platform to host your custom logic and reference from different types of Fabric items and data sources. You can use this service to write your business logic, internal algorithms, and libraries. You can also integrate it into your Fabric architectures to customize the behavior of your solutions.
The following are some of the benefits for logic using user data functions:
- Reusability: Invoke your functions from other Fabric items and create libraries of standardized functionality that can be used in many solutions within your organization.
- Customization: Use Python and public libraries from PyPI to create powerful applications that are tailored to your needs.
- Encapsulation: Create functions that perform several tasks to build sophisticated workflows.
- External connectivity: Invoke your user data functions from external client applications using a REST endpoint, opening up possibilities for integrations with external systems.
User Data Functions in Deployment Pipelines
You can also use deployment pipelines to deploy your user data functions code across different environments, such as development, test, and production. This feature can enable you to streamline your development process, ensure quality and consistency, and reduce manual errors with lightweight, low-code operations.
Create and Run User Data Functions Activity in Data Pipelines
Before using UDFs in your pipeline:
- Fabric account: Sign in or sign up.
- Workspace: Create or use an existing Fabric workspace.
- User Data Functions item: Create a UDF in that workspace.
Create the activity
- Create a new pipeline in your workspace.
- Search for Functions in the pipeline’s Activities pane, then select the found result to add it to the pipeline canvas.
- Select the new Functions activity on the pipeline editor canvas if it isn’t already selected.

Functions activity settings
The Functions activity has two settings:
- On the General tab, you can enter a name for the activity, set the retry configuration, and specify whether you’re passing secure input or output.

- On the Settings tab, you can then choose UserDataFunctions as the Type of functions activity. Select the workspace, user data functions item, and function name, then provide the input parameters for your selected function.

After you configure any other activities required for your pipeline, switch to the Home tab at the top of the pipeline editor, then select Save to save your pipeline. Select Run to run it directly, or choose Schedule to schedule it. You can also view the run history here or configure other settings.