.net 核心:如何从 C# 代码传递参数和运行 Azure 数据工厂管道?



我正在使用Microsoft.Azure.Management.DataFactory.net核心包。

我使用以下代码获取在 C# .net 核心中访问 azure 数据工厂管道所需的令牌:

public static void RunDataFactoryPipeline()
{
try
{
var context = new AuthenticationContext("" + "");
var credentials = new ClientCredential(clientId: "", clientSecret: "");
AuthenticationResult result = context.AcquireTokenAsync("", credentials).Result;
if (result == null)
{
throw new InvalidOperationException("Failed to acquire Token");
}
var token = result.AccessToken;
var serviceClientCredentials = new TokenCloudCredentials("",result.AccessToken);
var client = new DataFactoryManagementClient(serviceClientCredentials);
StartPipeline("name", "name", "name", client);
}
catch (Exception ex)
{
throw;
}
}
public static void StartPipeline(string resourceGroup, string dataFactory, string pipeLineName, DataFactoryManagementClient client, )
{
var pipeLine = client.Pipelines.Get(resourceGroup, dataFactory, pipeLineName);
}

但是我没有找到任何可以运行管道的方法 厂。

似乎您使用的不是 nuget 包,请使用这个包,您应该有可用于在 IPipelineOperations 实例上运行管道的方法

安装包 Microsoft.Azure.管理.数据工厂 - 版本 4.7.0

public static void StartPipeline(string resourceGroup, string dataFactory, string pipeLineName, DataFactoryManagementClient client )
{
var pipeLine = client.Pipelines.Get(resourceGroup, dataFactory, pipeLineName);
client.Pipelines.CreateRun(resourceGroup, dataFactory, pipeLineName);
}

相关内容

  • 没有找到相关文章