Forum Discussion
User Properties of Activities in ADF: How to add dynamic content in it?
You can absolutely attach dynamic content to the User properties of ADF activities (including Execute Pipeline inside a ForEach), and those values will show up in Monitor → Activity runs and in Azure Monitor / Log Analytics for filtering and diagnostics.
Below is a concise “how‑to”, plus examples and KQL to query them.
What user properties are (and their limits)
- User properties are key–value pairs you add at the activity level to surface extra metadata during monitoring.
- You can add up to 5 user properties per activity.
- Unlike annotations, user properties can be dynamic (evaluated at runtime). You configure them on the activity’s User properties tab. https://learn.microsoft.com/en-us/azure/data-factory/concepts-annotations-user-properties, https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/data-factory/concepts-annotations-user-properties.md, https://docs.azure.cn/en-us/data-factory/concepts-annotations-user-properties
Tip: The expression builder link isn’t shown on the User properties pane, but you can still type ADF expressions directly (using the @{...} syntax) and they’ll be evaluated at runtime. https://davidalzamendi.com/monitor-azure-data-factory-user-properties/, https://segunakinyemi.com/blog/adf-synapse-dynamic-user-properties/
Syntax to use for dynamic values
Use the standard ADF expression language, but wrap the expression in @{ ... } when typing into a User property value:
- Pipeline parameter: @{pipeline().parameters.JobId}
- Pipeline variable: @{variables('StepName')}
- ForEach item: @{item().StepName} (or whatever your item schema is)
- Output of a prior activity: @{activity('GetMeta').output.someField} https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/data-factory/how-to-expression-language-functions.md, https://segunakinyemi.com/blog/adf-synapse-dynamic-user-properties/
Example: ForEach → Execute Pipeline with labeled user properties
Imagine your outer pipeline iterates over a list of steps:
// Example items supplied to ForEach
[
Inside the ForEach, you have an Execute Pipeline activity calling Child_LoadStep. On that activity’s User properties tab, add entries like:
- Key: JobId — Value: @{pipeline().parameters.JobId}
- Key: StepId — Value: @{item().StepId}
- Key: StepName — Value: @{item().StepName}
- Key: ParentRunId — Value: @{pipeline().RunId}
These will be evaluated per iteration and shown in Monitor → Activity runs. You can also filter or export them to Log Analytics as part of your diagnostic logs. https://learn.microsoft.com/en-us/azure/data-factory/concepts-annotations-user-properties, https://docs.azure.cn/en-us/data-factory/monitor-visually
Reminder: You can define up to five user properties per activity. If you need more metadata, consider combining fields (e.g., a single JSON string) or using annotations for static tags at the pipeline level. https://learn.microsoft.com/en-us/azure/data-factory/concepts-annotations-user-properties
Passing values into the child pipeline (optional)
If you also want the child pipeline to know which step it’s running, add Parameters on the Execute Pipeline activity (e.g., StepId = @{item().StepId}), and inside the child, expose those again as User properties for its own activities:
- Key: ChildStepId — Value: @{pipeline().parameters.StepId}
- Key: ChildStepName — Value: @{pipeline().parameters.StepName} https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/data-factory/how-to-expression-language-functions.md
Querying user properties in Azure Monitor / Log Analytics (KQL)
Once Diagnostic settings are enabled for ADF, user properties flow into ADFActivityRun. Here are helpful KQL snippets:
// Show recent activity runs with user properties for a given pipeline run
ADFActivityRun
| where TimeGenerated > ago(24h)
| where PipelineName == "Master_Orchestrator"
| project TimeGenerated, PipelineRunId, ActivityName, ActivityType,
Status, DurationMs, UserProperties // dynamic column
| take 100
// Filter by a specific dynamic user property value (e.g., StepName == "Transform")
ADFActivityRun
| where TimeGenerated > ago(24h)
| mv-expand UserProperties
| where tostring(UserProperties["StepName"]) == "Transform"
| project TimeGenerated, PipelineRunId, ActivityName, Status, DurationMs
These tables and the presence of UserProperties are documented across ADF monitoring guidance and community diagnostics write‑ups. https://azuretechinsider.com/azure-data-factory-user-properties-and-kql/, https://docs.azure.cn/en-us/data-factory/monitor-visually
Common pitfalls & tips
- No expression builder UI? Type your expression directly using @{...}—ADF will still evaluate it. https://davidalzamendi.com/monitor-azure-data-factory-user-properties/, https://segunakinyemi.com/blog/adf-synapse-dynamic-user-properties/
- Keep values lightweight: User properties are intended for human‑readable labels (IDs, names). Prefer storing large outputs in activity output JSON or external logs. https://learn.microsoft.com/en-us/azure/data-factory/concepts-annotations-user-properties
- Use annotations for static grouping (e.g., business unit) and user properties for per‑run dynamic labels (e.g., StepId, OrderId). https://learn.microsoft.com/en-us/azure/data-factory/concepts-annotations-user-properties, https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/data-factory/concepts-annotations-user-properties.md
- Five‑property limit: Collapse multiple tags into a single JSON string if needed (e.g., @{string(concat('{\"StepId\":', item().StepId, ',\"JobId\":\"', pipeline().parameters.JobId, '\"}'))}), then parse in KQL with parse_json(UserProperties["Labels"]). https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/data-factory/how-to-expression-language-functions.md
- You can add dynamic expressions to User properties on an Execute Pipeline inside a ForEach.
- Use the @{...} syntax with ADF expressions like item(), pipeline().parameters, variables(), or prior activity() outputs.
- You’ll see those values in Monitor → Activity runs and can query them via ADFActivityRun in Log Analytics. https://learn.microsoft.com/en-us/azure/data-factory/concepts-annotations-user-properties, https://segunakinyemi.com/blog/adf-synapse-dynamic-user-properties/, https://azuretechinsider.com/azure-data-factory-user-properties-and-kql/