-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Description
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:
- Map to
BicepValue<BinaryData>- allows arbitrary JSON including expression objects, but loses type safety - Create a custom
BicepDataFactoryExpression<T>- a provisioning-specific type that can serialize to either a literalTor a{ value, type }expression object - Map to
BicepValue<string>always - since Data Factory expressions are string-based, always emit as string and let ADF runtime handle type coercion - 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.DataFactorypackage - definesDataFactoryElement<T>- Generator code:
sdk/provisioning/Generator/src/Specifications/DataFactorySpecification.cs