Forum Discussion
Dynamically executing a child pipeline using a single Execute Pipeline activity with a variable
As far as I know, this is not possible. The pipeline must be selected at design time for validation purposes.
Workarounds:
- Use a Switch Activity to call different pipelines based on the value.
For example:
Master Pipeline
- Lookup (get caseValue)
- Switch Activity (evaluate caseValue)
- Case = "LoadCustomers" > Execute Pipeline: LoadCustomersPipeline
- Case = "LoadOrders" > Execute Pipeline: LoadOrdersPipeline
- Case = "LoadProducts" > Execute Pipeline: LoadProductsPipeline - Create a generic child pipeline that handles different logic based on a passed parameter.
For example:
MasterPipeline
- Lookup (Metadata)
- Set Variable (taskType)
- Execute Pipeline (GenericChildPipeline, passing taskType)
GenericChildPipeline (parameter: taskType)
- Switch
- Case: LoadCustomers > Customer Copy Activity
- Case: LoadOrders > Orders Copy Activity
- Case: LoadProducts > Products Copy Activity - Metadata-driven with using a Web Activity to trigger the pipeline dynamically via ADF REST API.
For example:
MasterPipeline
- Lookup (Get Metadata - includes pipeline name)
- Web Activity (Trigger Pipeline via REST API - dynamic URL) - Orchestrate externally using Logic Apps, Azure Functions, or custom scripts.
Thank you for getting back. The existing approach uses a Switch Activity to call different pipelines based on the value (like you'd mentioned)
But we are running out of cases (25 limit in Switch) and we already have 2 master pipelines with close to 50 cases (25 each). I was looking for a way to optimise it and make it singular.
Web Activity is another possibility I'm exploring but cannot pass pipeline parameters dynamically, it's failing to capture the values. Any idea why this could be so?
- SshahanazApr 07, 2025Copper Contributor
As far as I know for Web Activity it requires several components and need to set up Global Parameters in your ADF such as subscriptionId, ResourceGroupName and factory Name - these can be set in the ADF portal under "Manage" -- "Global parameters" and also to connect to the Azure Management API uses MSI authentication.
So I think the critical issues may occurs on how are we formatting the parameters in the Web Activity body.
Storing parameters separately, you might need to build the JSON manually example:
@concat('{\"parameters\":{\"param1\":\"', variables('param1'), '\",\"param2\":\"', variables('param2'), '\"}}')
In above JSON structure, even small errors or quotes escaping or at name of parameters may cause failing to capture the values.