无法 运行 来自 Azure 的 Azure 数据工厂功能

Can't run Azure data factory from Azure function

这是我的 c# Azure 函数脚本:

#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' 转换为 'string' .但同样的事情在 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。