How to move a Blob to another Container

twitter logo ・1 min read

In this post, I am going to share a method that moves a blob to another container.

This content applies for:

  • Azure Storage Accounts.
  • .NET Core 2.2.
  • Different containers on the same storage account.


  1. I have a CloudStorageAccount object that represents the Azure Storage Account.
  2. I have a CloudBlobClient object that represents a Blob service.
  3. In the constructor, CloudStorageAccount and CloudBlobClient are initialized.
  4. MoveBlob method creates a reference of source container and destination container using GetContainerReference method of CloudBlobClient object.
  5. I get a blob reference using GetBlockBlobReference method using the previous containers references.
  6. Finally, I invoke StartCopyAsync method in order to copy the blob to another container, then, the source blob is deleted.
twitter logo DISCUSS (1)
markdown guide

Do note that the copy operation may not be complete by the time "MoveBlob" completes. You will need to poll "destinationBlob.CopyState.Status" (after refreshing attributes using "destinationBlob.FetchAttributesAsync()")!

Classic DEV Post from Jun 14

How do you organize your projects?

Where do you keep your side projects and portfolio?

LFC profile image
I´m a Senior Software Engineer and Software Architect. I really love .NET technologies and Cloud Development on Microsoft Azure.

Night owl? 🦉 now has a dark version (in public beta).

Go to the "misc" section of your settings and select night theme ❤️