从Azure函数C#将文件保存到Data Lake

时间:2019-12-05 05:27:09

标签: c# azure-functions azure-data-lake

我正在努力获取将内容保存到数据湖的azure函数,尽管没有成功,但我尝试了以下技术,是否有示例?

Running a custom extension

azure-functions-datalake-extension

代码示例

using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;
using Microsoft.Azure.WebJobs.Extensions.DataLake;
using Microsoft.Azure.Management.DataLake.Store;
using System.Threading.Tasks;
using System.IO;

namespace FunctionApp1
{
    public static class Function1
    {    
        [FunctionName("DataLakeExample")]
        public static async Task Run([TimerTrigger("*/15 * * * * *")] TimerInfo myTimer, [DataLake("clientId", "clientSecret")] DataLakeProvider dataLake, TraceWriter log)
        {
            log.Info($"C# Timer trigger function executed at: {DateTime.Now}");

            using (dataLake)
            {
                var path = Path.Combine("This", "Is", "Just", "A", "Test2");
                await dataLake.CreateDirectory(path);
                await dataLake.AppendToFile(Path.Combine(path, "foo"), "THIS IS JUST A TEST");
            }
        }
    }
}

收到错误

  

我收到一个编译器错误,指出datalakeprovider不是   找到

我已经下载了Install-Package Microsoft.Azure.DataLake.Store -Version 1.1.19

0 个答案:

没有答案