Skip to content

[Azure.Provisioning.DataFactory] Design proper mapping for DataFactoryElement<T> in provisioning library #57156

@ArcturusZhang

Description

@ArcturusZhang

Summary

The current Azure.Provisioning.DataFactory generator maps DataFactoryElement<T> (from the Azure.Core.Expressions.DataFactory package) to BicepValue<T> by unwrapping the generic type argument. This mapping is incorrect and needs a proper design.

Background

DataFactoryElement<T> is a special type in the Azure Data Factory SDK that represents values which can be one of:

  • A literal value of type T
  • A Data Factory expression (e.g., @pipeline().parameters.myParam)
  • A secret reference (Azure Key Vault)

When we generate the provisioning library, the generator's ResolveExternalGenericType hook simply strips the DataFactoryElement<T> wrapper and uses T directly, which then becomes BicepValue<T> in the generated code. This loses the ability to express Data Factory expressions and secret references in the Bicep output.

Current Behavior

DataFactoryElement<string> -> generator unwraps to string -> becomes BicepValue<string>

This means a property like FilterActivity.Condition (which is DataFactoryElement<bool>) becomes BicepValue<bool> and can only hold a literal boolean value - it cannot represent a Data Factory expression like @equals(1, 1).

Expected Behavior

We need a proper design that preserves the semantics of DataFactoryElement<T> in Bicep. Options to consider:

  1. Map to BicepValue<BinaryData> - allows arbitrary JSON including expression objects, but loses type safety
  2. Create a custom BicepDataFactoryExpression<T> - a provisioning-specific type that can serialize to either a literal T or a { value, type } expression object
  3. Map to BicepValue<string> always - since Data Factory expressions are string-based, always emit as string and let ADF runtime handle type coercion
  4. Other approaches - open to discussion

Affected Properties

Hundreds of properties across the Data Factory provisioning library use DataFactoryElement<T> in the management SDK, including:

  • FilterActivity.Condition (DataFactoryElement<bool>)
  • FilterActivity.Items (DataFactoryElement<IList<DataFactoryElement<string>>>)
  • CopyActivity.EnableStaging (DataFactoryElement<bool>)
  • Many linked service connection properties

Related

  • PR Add Azure.Provisioning.DataFactory library #57127 - Initial Azure.Provisioning.DataFactory library
  • Azure.Core.Expressions.DataFactory package - defines DataFactoryElement<T>
  • Generator code: sdk/provisioning/Generator/src/Specifications/DataFactorySpecification.cs

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions