Is there a way to set the tier of the destination blob when copying from a File Share to a Blob Storage? AzCopy, which uses Azure Storage Data Movement Library for .Net behind the scenes, has --block-blob-tier option. So, I thought this could be probably possible to achieve using the library.
3 Answers
Azure Storage Data Movement Library still not support copyd blob with blob tier. Would you like to open an issue in https://github.com/Azure/azure-storage-net-data-movement/issues to track the feature request?
Would you please share your scenario like the DMlib copy command?
As a workaround, you might can set the blob tier are they are uploaded with DMlib?
DMLib (Data Movement Library) does not support setting blob tier yet. Regarding “copying from a File Share to a Blob Storage”, are you using Service Side Asynchronous Copy documented below?
https://github.com/Azure/azure-storage-net-data-movement#choose-copy-method https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.storage.datamovement.copymethod?view=azure-dotnet
As mentioned previously in the answers, DMLib does not support setting the blob tier for copy from file storage to blob storage. As a workaround, I use the following code snippet and NuGet packages to copy directly from file share to blob storage.
- Azure.Storage.Files.Shares
Azure.Storage.Blobs
ShareFileClient shareFileClient = GetFile(); // get the ShareFileClient var blobClient = new BlobServiceClient(blobConnectionString); var container = blobClient.GetBlobContainerClient(blobContainerName); var destBlob = container.GetBlobClient(shareFile.Path); // set the path of the destination blob await destBlob.StartCopyFromUriAsync(shareFile.Uri, accessTier: accessTier);
I got the idea from Microsoft's documentation, but the code was using the older version of FileShare SDK. My code uses the latest version.