Copying one Azure blob to another blob in Azure Storage Client 2.0
Copying one Azure blob to another blob in Azure Storage Client 2.0
Copying one Azure blob to another blob in Azure Storage Client 2.0
Re: Copying one Azure blob to another blob in Azure Storage Client 2.0
[Gaurav Mantri](http://gauravmantri.com/) has written a series of articles on Azure Storage on version 2.0. I have taken this code extract from his blog post of [Storage Client Library 2.0 – Migrating Blob Storage Code](http://gauravmantri.com/2012/11/28/storage-client-library-2-0-migrating-blob-storage-code/) for Blob Copy
```
CloudStorageAccount storageAccount = new CloudStorageAccount(new StorageCredentials(accountName, accountKey), true);
CloudBlobClient cloudBlobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer sourceContainer = cloudBlobClient.GetContainerReference(containerName);
CloudBlobContainer targetContainer = cloudBlobClient.GetContainerReference(targetContainerName);
string blobName = "";
CloudBlockBlob sourceBlob = sourceContainer.GetBlockBlobReference(blobName);
CloudBlockBlob targetBlob = targetContainer.GetBlockBlobReference(blobName);
targetBlob.StartCopyFromBlob(sourceBlob);
```
```
CloudStorageAccount storageAccount = new CloudStorageAccount(new StorageCredentials(accountName, accountKey), true);
CloudBlobClient cloudBlobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer sourceContainer = cloudBlobClient.GetContainerReference(containerName);
CloudBlobContainer targetContainer = cloudBlobClient.GetContainerReference(targetContainerName);
string blobName = "";
CloudBlockBlob sourceBlob = sourceContainer.GetBlockBlobReference(blobName);
CloudBlockBlob targetBlob = targetContainer.GetBlockBlobReference(blobName);
targetBlob.StartCopyFromBlob(sourceBlob);
```