[英]ResourceNotFound, The Resource Microsoft.DataFactory/factories/… under resource group '…' was not found
[英]Access Azure Data Factory V2 programmatically: The Resource Microsoft.DataFactory/dataFactories/ under resource group was not found
我正在尝试以编程方式访问 Azure Data Fabric V2。
首先,我在 Azure 门户中创建了一个应用注册和一个客户端机密。 然后,我在整个订阅中以及在我的数据工厂所在的资源组中授予 Contributor 注册此 App 的权限。 使用此凭据,我可以登录门户并创建 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:未找到资源组“MyResGroup”下的资源“Microsoft.DataFactory/dataFactories/MyPipeline”。
我已经验证资源组、数据工厂名称和管道名称是正确的,但它一直抛出这个错误。
我遇到了同样的问题,这是由于引用了 Azure 数据工厂 v1 而不是 v2 的 Nuget 包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.