[英]How can I get multiple blobs out of an Azure Function?
I'm coding a C# function which is triggered by the upload of a blob.我正在编写一个由 blob 上传触发的 C# 函数。 I would like to read another file in the container.
我想读取容器中的另一个文件。 How would the input binding bring the second blob?
输入绑定将如何带来第二个 blob?
public static async Task Run([BlobTrigger("csv/{name}.csv", Connection = "StorageConnectionAppSetting")]Stream myBlob, string name, ILogger log)
In addition to this question, how can I reference values from the local.settings.json in my code?除了这个问题,如何在我的代码中引用 local.settings.json 中的值? I'm able to reference the "StorageConnectionAppSetting" on the input binding but I'm not sure how to do the same for portions of my code where I'm creating clients using APIKEYs.
我可以在输入绑定上引用“StorageConnectionAppSetting”,但我不确定如何对我使用 APIKEY 创建客户端的代码部分执行相同的操作。
Thanks!谢谢!
CloudBlobContainer
by adding a reference to the storage SDK, and then read any blobs in that container.CloudBlobContainer
添加输入绑定,然后读取该容器中的任何 Blob。 https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-blob-input?tabs=csharp#usage . Another option would be not to use input binding and read the container and its contents the way you would normally do using storage SDK.另一种选择是不使用输入绑定并像通常使用存储 SDK 那样读取容器及其内容。 You will need to add reference to
Microsoft.Azure.Storage.Blob
in both the cases.在这两种情况下,您都需要添加对
Microsoft.Azure.Storage.Blob
引用。
System.Environment.GetEnvironmentVariable("APIKEY");
System.Environment.GetEnvironmentVariable("APIKEY");
, assuming APIKEY
is your customer setting. APIKEY
是您的客户设置。 Remember, local.settings.json will only be local and you will need to set these values in Azure either via Azure Portal or your CI/CD pipeline via and ARM template. You can also use Azure functions dependency injection and inject configuration.您还可以使用 Azure 函数依赖项注入和注入配置。 Check the section
Working with options and settings
at https://docs.microsoft.com/en-us/azure/azure-functions/functions-dotnet-dependency-injection#working-with-options-and-settings检查https://docs.microsoft.com/en-us/azure/azure-functions/functions-dotnet-dependency-injection#working-with-options-and-settings 上的“
Working with options and settings
”部分
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.