c# - .net核心: How to pass parameters and run Azure data factory pipeline from C# Code?

标签 c# azure asp.net-core .net-core azure-data-factory

我正在使用 Microsoft.Azure.Management.DataFactories .net core 包。

我使用以下代码来获取访问 C# .net core 中的 azure 数据工厂管道所需的 token :

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);
}

But i don't find any method using which i can run the pipeline in factory.

最佳答案

似乎您使用了不正确的 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);
}

关于c# - .net核心: How to pass parameters and run Azure data factory pipeline from C# Code?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60218160/

相关文章:

c# - 免费的SQL Server存储过程生成器?

c# - Foreach ListView 中的子项

c# - 自定义类型 Convert.ToString

azure - 我应该如何将后端解决方案链接到 IoT 中心

azure - 已验证的开放 API 规范无法上传到 Azure API 管理

c# - ASP.NET 身份 - 简化

azure - 当托管在 Linux 容器中时,ASP.NET Core 在 OAuth 质询中传递 HTTP(而非 HTTPS)重定向 URL

c# - WM 和 C# : How to set up a WiFi Ad-Hoc connection programmatically?

azure - 如何在Azure Maps中绘制圆形路径?

c# - 使用 Github Actions 将多项目 ASP.NET Core Web 应用部署到 Azure 应用服务