Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create copy of file on Azure Blob Storage

How do I create a copy of an existing file in an Azure Blob Storage container using code? I'm using the WindowsAzure.Storage NuGet package to handle all operations related to my Azure Blob Storage.

To be 100% clear, I'm trying to create a complete and separate copy of a file that's already been uploaded to a container on Azure Blob Storage. I also want to give the file a new name in the process.

like image 257
Sam Avatar asked Oct 19 '25 09:10

Sam


2 Answers

Purely in code, you'll want to use StartCopyAsync() a method on CloudBlockBlob, to start the copy process.

like image 186
David Makogon Avatar answered Oct 21 '25 21:10

David Makogon


One simple way is to use a logic app that triggers on a blob being created that will then copy the blob.

https://learn.microsoft.com/en-us/azure/connectors/connectors-create-api-azureblobstorage

If you want to get more sophisticated, you can do a function app.

https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-storage-blob-triggered-function

like image 30
Ken W MSFT Avatar answered Oct 21 '25 23:10

Ken W MSFT



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!