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.
- I have a CloudStorageAccount object that represents the Azure Storage Account.
- I have a CloudBlobClient object that represents a Blob service.
- In the constructor, CloudStorageAccount and CloudBlobClient are initialized.
- MoveBlob method creates a reference of source container and destination container using GetContainerReference method of CloudBlobClient object.
- I get a blob reference using GetBlockBlobReference method using the previous containers references.
- Finally, I invoke StartCopyAsync method in order to copy the blob to another container, then, the source blob is deleted.