Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
You can develop your Fabric User data functions directly from your browser using the portal editor. The portal allows you to create, modify, test, and publish your functions from your browser. In this article, you'll learn the following topics:
- Overview of the portal editor.
- User Data Functions properties and metadata.
- Features of the portal editor.
Overview of the portal editor
The portal editor is the web-based interface that you access when you open your User Data Functions items. The following are the elements of the portal editor:
- Home / Edit tab: Use these tabs to switch the top toolbar between the Home tools to the Edit tools.
- Settings: This button opens the User Data Functions item settings. The settings include item description, sensitivity label, endorsement, manage connections, and library management settings. The settings in this menu are applicable to all functions in this item.
- Functions list: This list contains the functions inside of this User Data Functions item. If you are in Develop mode, this list may include new and unpublished functions. If you are in Run/View only modes, this list only includes published functions. Hovering over a list item reveals Run or Test functionality along with more options.
- Code viewer/editor: The code editor contains the code for all the functions in this User Data Functions item. If you are in Develop mode, this code is editable and it may include functions that have not been published yet. If you are in Run/View only modes, this code is read-only and shows only functions that were published.
- Status bar: This bar contains two elements:
- Test session indicator: Used in Develop mode, this indicator shows if your test session is running. Learn more about testing functions in the Develop mode documentation.
- Publish process indicator: This indicator shows if your functions are currently being published, or the timestamp of the last time they were successfully published.
- Mode switcher: This drop-down menu allows you to switch between Develop mode and Run/View only mode. Learn more in the Develop mode documentation.
- Share button: This feature allows you to share this User Data Functions item with other users and assign permissions to them (Share, Edit and/or Execute permissions).
- Publish button: This button starts the publish process for your User Data Functions item. This process publishes all functions in your item. After your functions are published, other users and Fabric items can run your functions.
Home toolbar
This toolbar provides features that are applicable to all functions in the User Data Functions items. Some of these features are only available in Develop mode.
- Settings: This button opens the User Data Functions item settings. The settings include item description, sensitivity label, endorsement, manage connections and library management settings. The settings in this menu are applicable to all functions in this item.
- Refresh button: This button refreshes the User Data Functions item with the latest published functions and metadata. You can use this feature to ensure you are working with the latest version of your code.
- Language selector: For now, this read-only button shows Python as the default option.
- Generate invocation code: This feature automatically generates code based on your published functions. Learn more about the Generate invocation code feature.
- Manage connections: This feature allows you to create connections to other Fabric items using the OneLake data catalog. Learn more about the Manage connections feature.
- Library management: This feature allows you to install public and private libraries for your function code to use. Learn more about the Library management feature.
- Open in VS Code button: This button allows you to open your functions in the VS Code editor by using the Fabric User Data Functions VS Code extension. Learn more about using the VS Code extension.
- Publish button: This button starts the publish process for your User Data Functions item. This process publishes all functions in your item. This button is only enabled in Develop mode.
Edit toolbar
This toolbar provides features to help you edit your functions code. Some of these features are only available in Develop mode.
- Reset code button: This button resets all your functions to the published version of the code. This feature undoes any code changes that are different from the published functions. This button is only enabled in Develop mode.
- Edit buttons: These buttons provide the following functionality for the code editor: Undo, Redo, Copy, and Paste. This button is only enabled in Develop mode.
- Insert sample: This feature provides code templates that help you get started for a given scenario. Once you select a code template, it is inserted at the bottom of your functions. Make sure you install the necessary libraries and add the necessary connections according to the programming model guidelines. This feature is only enabled in Develop mode.
- Manage connections: This feature allows you to create connections to other Fabric items using the OneLake data catalog. Learn more about the Manage connections feature.
- Library management: This feature allows you to install public and private libraries for your function code to use. Learn more about the Library management feature.
- Find and replace: This feature allows you to search for keywords in the code editor and replace them as needed. This feature is only enabled in Develop mode.
- Publish button: This button starts the publish process for your User Data Functions item. This process will publish all functions in your item. This button is only enabled in Develop mode.
Generate invocation code feature
You can use this feature to automatically generate different types of code templates based on your functions. There are two types of code:
- Client code
- OpenAPI specification
Client code
This feature allows you to generate code for the following scenarios:
- Client application: This feature generates code to run in an application using the public endpoint of your User Data Functions item in your language of choice.
- Fabric Notebooks: This feature generates code to run from your Fabric Notebooks in your language of choice.
Client application
This feature generates a code snippet to invoke your functions from a client application. You can choose between Python, C# or Node.js in the code options.
This article contains an example for how to use this invocation code in a Python client application.
Fabric Notebooks
This feature generates a code snippet you can use to invoke your functions from a Fabric Notebook.
For more examples in different languages, visit the Fabric Notebooks User Data Functions utilities documentation article.
OpenAPI specification
The Open API specification, formerly Swagger Specification, is a widely used, language-agnostic description format for REST APIs. This specification allows humans and computers alike to discover and understand the capabilities of a service in a standardized format. This specification is useful for creating integrations with external systems and AI agents and generating client code in any language using OpenAPI Codegen.
This feature generates an OpenAPI specification in JSON or YAML format for all your functions. This feature uses the DOCSTRING property of your functions in addition to the function parameters, error messages, and endpoints.
To define the content for your API documentation, use the following properties in the DOCSTRING of your functions:
- Summary: This field provides a one-line explanation of the function. The summary is often displayed in a high-level view of a library or API that consumes the specification. In the OpenAPI schema, this property corresponds to the "summary" field in the OpenAPI specification.
- Description: This field is used for a detailed explanation of the purpose and behavior of the function. You can use multiple lines to describe the function outputs, input, and any potential side effects or exceptions it raises. This property corresponds to the "description" field in the OpenAPI specification.
This is an example function with a DOCSTRING:
@udf.function()
def hello_fabric(name: str) -> str:
"""
Summary: A Python function that prints your name and the time.
Description: This functions takes a string input and concatenates it with the current time
to give you a warm welcome to User Data Functions. This function returns a string and
provides a log entry.
"""
logging.info('Python UDF trigger function processed a request.')
return f"Welcome to Fabric Functions, {name}, at {datetime.datetime.now()}!"
Next steps
- Learn more about the service limitations.
- Create a Fabric User data functions item from within Fabric or use the Visual Studio Code extension
- Learn about the User data functions programming model