Share via


UserDataFunctionContext Class

This class is used to be able to access certain metadata about a function invocation.

A User Data Function with a parameter of this type must be decorated with context (see the example under Remarks).

Don't worry about using the constructor to create an instance of this class. Fabric will automatically create it for you (as long as you follow the steps within Remarks).

Constructor

UserDataFunctionContext(invocationId: str, executingUser: Dict[str, str])

Parameters

Name Description
invocationId
Required
str

The unique identifier for the function invocation.

executingUser
Required

Metadata about the user token used to execute the function.

Remarks

Note

Do not use the parameter name "context" for this (or any) parameter in your User Data Function.

To use this class and have Fabric generate the metadata, you must:

  • Add a parameter to your User Data Function with the type 'UserDataFunctionContext'.
  • Add the decorator context to your User Data Function that references the parameter.

Attributes

executing_user

Metadata about the user token used to execute the function.

Remarks

The dictionary contains the following keys:

  • Oid: The user's object id, which is an immutable identifier for the requestor, which is the verified identity of the user or service principal. This ID uniquely identifies the requestor across applications. We suggest using this in tandem with TenantId to be the values to perform authorization checks.
  • PreferredUsername: The preferred username of the user, which can be an email address, phone number, generic username, or unformatted string. This is mutable.
  • TenantId: The tenant id of the user, which represents the tenant that the user is signed into.

invocation_id

The unique identifier for the function invocation.