Reputation: 113
I am able to upload small files to fileshare using below code but large files are not getting transferred. There are methods like blob.PutBlock
available to upload files to Blob, but can't find anything for fileshare. Can you please guide me?
StorageCredentials cred = new StorageCredentials("SASToken");
CloudFileClient fClient = new CloudFileClient(new Uri(FileShareUrl)), cred);
CloudFileShare fshare = fileClient.GetShareReference("FileShareName");
CloudFileDirectory root = share.GetRootDirectoryReference();
CloudFileDirectory dir = root.GetDirectoryReference("Folder/subfolder");
var cloudFile = dir.GetFileReference(fileName);
await cloudFile.UploadFromStreamAsync(incomingBlob).ConfigureAwait(false);
Upvotes: 0
Views: 835
Reputation: 18546
Instead of streaming large files through your Azure Function, you should use the DataMovement library to copy the files directly from blob storage to your target file share.
The TransferManager
class has a corresponding CopyAsync
method to copy files from blob to file share.
Here are some samples to get you started with the library, you just need to adjust it to file share instead of blobs.
Upvotes: 1