我正在学习如何将存储 blob 与 Azure Functions 一起使用,我遵循了此文档:https : //docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-dotnet
// Create a BlobServiceClient object which will be used to create a container client
BlobServiceClient blobServiceClient = new BlobServiceClient(connectionString);
// Create the container and return a container client object
BlobContainerClient containerClient = await blobServiceClient.CreateBlobContainerAsync("<containername>");
// Get a reference to a blob
BlobClient blobClient = containerClient.GetBlobClient("<blobname>");
// Open the file and upload its data
using FileStream uploadFileStream = File.OpenRead("<localfilepath>");
await blobClient.UploadAsync(uploadFileStream, true);
uploadFileStream.Close();
Run Code Online (Sandbox Code Playgroud)
教程中的这段代码仅展示了如何在新容器中上传 blob,但我想上传到现有容器。我能做什么?谢谢。