我需要一些从C#代码调用ADF(Azure数据工厂(作业的想法。如果你能分享一些实现这一点的例子,那将非常有帮助。
谢谢你查看我的帖子。
安装最新版本的Microsoft.Azure.Management.DataFactory
NuGet包。然后你可以触发这样的ADF管道:
private DataFactoryManagementClient CreateClient(string subscriptionId, string tenantId)
{
// AzureServiceTokenProvider uses developer credentials when running locally
// and uses managed identity when deployed to Azure.
// If getting an exception when running locally, run "az login" command in Azure CLI
var provider = new AzureServiceTokenProvider();
var token = provider.GetAccessTokenAsync("https://management.azure.com", tenantId).Result;
ServiceClientCredentials credentials = new TokenCredentials(token);
DataFactoryManagementClient client = new DataFactoryManagementClient(credentials);
client.SubscriptionId = subscriptionId;
return client;
}
public async Task<string> TriggerPipeline(string pipelineName, IDictionary<string, object> parameters)
{
var run = await client.Pipelines.CreateRunWithHttpMessagesAsync(resourceGroupName, dataFactoryName, pipelineName, parameters: parameters);
return run.Body.RunId;
}