'How to pass parameter programmatically to Azure Data Factory Pipeline through Azure Function from C# code?
I want to pass the output parameter to the Azure Data factory Pipeline.
eg. I have parameter like this
pipelineparameter:
{
"emp_id":1,
"emp_name": "Havells",
"emp_dept":"IT"
}
The code is as below..
{
CreateRunResponse runResponse;
PipelineRun pipelineRun;
runResponse = client.Pipelines.CreateRunWithHttpMessagesAsync(
resourceGroup, factoryName, pipelineName, parameters: (IDictionary<string, object>)parameters).Result.Body;
}
When I tried to read that parameter like the below manner
'pipelineRun.Parameters'
then it gives me an error like this: System.Collections.Generic.Dictionary`2[System.String,System.String]
Solution 1:[1]
This is the code I use in my Azure Function:
public async Task<string> RunPipelineAsync(string resourceGroupName,
string dataFactoryName,
string pipelineName,
Dictionary<string, object> parameters = null,
Dictionary<string, List<string>> customHeaders = null)
{
var runResponse = await Client.Pipelines.CreateRunWithHttpMessagesAsync(resourceGroupName, dataFactoryName, pipelineName, parameters: parameters , customHeaders: customHeaders);
return runResponse.Body.RunId;
}
Without being able to see your entire error message, my assumption is that the object parameters is failing to cast to IDictionary<string, object>.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Joel Cochran |
