无法从 Azure 函数运行 Azure 数据工厂



这是我的c# Azure Function脚本:

#r "System.Runtime"
#r "System.Threading.Tasks"
using System;
using System.Net;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Microsoft.Azure;
using Microsoft.Azure.Management.DataFactory;
using Microsoft.Azure.Management.DataFactory.Models;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Microsoft.Rest;
public static void Run(TimerInfo myTimer, TraceWriter log)
{
log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
/*...All variable definations...*/

var authenticationContext = new AuthenticationContext(activeDirectoryEndpoint + activeDirectoryTenantld);    
ClientCredential credential = new ClientCredential(clientld, clientSecret);    
AuthenticationResult result = authenticationContext.AcquireTokenAsync(windowsManagementUri, credential).Result; 
ServiceClientCredentials cred = new TokenCredentials(result.AccessToken);
var client = new DataFactoryManagementClient(cred) { SubscriptionId = subscriptionId };
Dictionary<string, object> arguments = new Dictionary<string, object>
{
{ "bufferdays", 10 },
{"TimeToCopy", 20 }
};    
CreateRunResponse runResponse = client.Pipelines.CreateRunWithHttpMessagesAsync(resourceGroupName, dataFactoryName, pipelineName,arguments).Result.Body;
}

这将引发错误run.csx(56,130(:错误 CS1503:参数 4:无法从"System.Collections.Generic.Dictionary"转换为"字符串"。但是同样的事情在Visual Studio中工作得很好。这是怎么回事?

知道了。

I was using {
"frameworks": {
"net46":{
"dependencies": {
"Microsoft.Azure.Management.DataFactory": "0.8.0",

在Project.json中,它会自动下载1.0.0版本。我不得不通过明确指定"Microsoft.Azure.Management.DataFactory": "0.8.0-preview",来强制它下载 0.8.0 版。

相关内容

  • 没有找到相关文章

最新更新