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

2024-05-15

我在用Microsoft.Azure.管理.DataFactories.net 核心包。

我使用以下代码来获取访问 C# .net core 中的 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.Management.DataFactory -版本 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);
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

.net Core:如何从 C# 代码传递参数并运行 Azure 数据工厂管道? 的相关文章

随机推荐