【发布时间】:2020-07-31 23:16:21
【问题描述】:
我有生成凭据以传递给 DataFactoryManagementClient 的代码。它使用应用注册来获取凭据,就像我在控制台应用中启动它一样。
public DataFactoryClient(string tenantId, string subscriptionId, string applicationId, string clientSecret)
{
AuthenticationContext context = new AuthenticationContext("https://login.windows.net/" + tenantId);
ClientCredential clientCredential = new ClientCredential(applicationId, clientSecret);
AuthenticationResult result = context.AcquireTokenAsync(
"https://management.azure.com/", clientCredential).Result;
ServiceClientCredentials credentials = new TokenCredentials(result.AccessToken);
client = new DataFactoryManagementClient(credentials)
{
SubscriptionId = subscriptionId
};
}
我将代码移至 Azure 函数,现在我想摆脱应用注册,只使用自动分配的托管标识(我已启用)我不知道如何... DataFactoryManagementClient 期望ServiceClientCredentials 对象,但我有一个 ManagedIdentityCredential 对象。
有什么办法吗?
【问题讨论】:
-
您好,如果我的回复对您有帮助,请采纳,谢谢。
标签: azure-functions azure-data-factory azure-managed-identity