【问题标题】:Access Azure Data Factory V2 programmatically: The Resource Microsoft.DataFactory/dataFactories/ under resource group was not found以编程方式访问 Azure 数据工厂 V2:未找到资源组下的资源 Microsoft.DataFactory/dataFactories/
【发布时间】:2019-07-05 10:28:42
【问题描述】:

我正在尝试以编程方式访问 Azure Data Fabric V2。

首先,我在 Azure 门户中创建了一个应用注册和一个客户端密码。然后我在整个订阅以及我的数据工厂所在的资源组中授予了 Contributor 对该应用程序注册的权限。 使用此凭据,我可以登录门户并创建 DataFactoryManagementClient

private void CreateAdfClient()
{
    var authenticationContext = new AuthenticationContext($"https://login.windows.net/{tenantId}");
    var credential = new ClientCredential(clientId: appRegistrationClientId, clientSecret: appRegistrationClientkey);
    var result = authenticationContext.AcquireTokenAsync(resource: "https://management.core.windows.net/", clientCredential: credential).ConfigureAwait(false).GetAwaiter().GetResult();

    if (result == null)
    {
        throw new InvalidOperationException("Failed to obtain the JWT token");
    }

    var token = result.AccessToken;

    var tokenCloudCredentials = new TokenCloudCredentials(subscriptionId, token);
    datafactoryClient = new DataFactoryManagementClient(tokenCloudCredentials);
}

但是,当我尝试使用管道时

var pipeline = datafactoryClient.Pipelines.Get(resourceGroup, dataFactory, pipelineName);

它会抛出一个错误:

System.Private.CoreLib:执行函数时出现异常: StartRawMeasuresSync。 Microsoft.Azure.Management.DataFactories: ResourceNotFound:资源 资源组下的“Microsoft.DataFactory/dataFactories/MyPipeline” 找不到“MyResGroup”。

我已验证资源组、数据工厂名称和管道名称正确,但一直抛出此错误。

【问题讨论】:

    标签: azure azure-data-factory-2


    【解决方案1】:

    我遇到了同样的问题,这是由于引用了 Azure 数据工厂 v1 而不是 v2 的 Nuget 包。

    • 版本 1:Microsoft.Azure.Management.DataFactories
    • 版本 2:Microsoft.Azure.Management.DataFactory

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-04-10
      • 2010-12-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-05
      相关资源
      最近更新 更多