Is there any way by which we can rename the blob container name in windows azure ?
-
See http://stackoverflow.com/questions/3734672/azure-storage-blob-rename – Paul Zahra Sep 11 '12 at 13:21
5 Answers
This answer is not valid any more. It seems they removed this feature from "Microsoft Azure Storage Explorer"
Now, you can rename containers with Microsoft's "Microsoft Azure Storage Explorer" (after version 0.8.3). You can also rename azure tables and file shares with this tool. See the release notes here.
Note that this feature has the following disclaimer during usage.
Renaming works by copying to the new name, then deleting the source item. Renaming a blob container currently loses the container's properties and metadata, and may take a while if there are lots of blobs.
Therefore this is not an actual renaming behind the scenes and incurs read/write/transaction costs.

- 9,720
- 3
- 42
- 67
-
2I cannot confirm when the feature was removed, but as of January 16, 2023, this functionality is no longer supported by Azure Storage Explorer. – Crayons Jan 16 '23 at 05:45
UPDATE
Please see answer from Nuri Tasdemir below.
No. You can't rename a blob container in Windows Azure. What you could do is create a new blob container with the new name and copy blobs from old blob container to the new one. Once the blobs are copied, you can delete the old blob container. Please note that if you're doing the copy blob in Cloud, this operation is asynchronous. So ensure that the blobs are copied completely before deleting the blob container.

- 128,066
- 12
- 206
- 241
-
7It is now possible to do this with "Microsoft Azure Storage Explorer". Please see Nuri Tasdemir's answer. – tmutton Mar 06 '17 at 10:43
-
2
-
6
-
-
2@Ofer Zelig. I rolled back your edit. IMHO, if you are not happy with an answer, instead of editing it to something completely different, you can always cast vote or add your own answer. – Nuri Tasdemir Nov 12 '18 at 03:52
-
@NuriTasdemir first time ever that I encounter this behavior in Stack Overflow. My edit was for the best of the Stack Overflow community. It is the most correct answer, and certainly doesn't send the wrong message to the reader of your accepted answer who will wrongfully conclude that there is no feasible option to do it and work hard. Editing this (accepted) answer is the right thing to do as it serves as the canonical answer one reads when they search for this matter. – Ofer Zelig Nov 12 '18 at 09:58
-
@NuriTasdemir also, except for saying you rolled back my answer, you didn't say what's _wrong_ with it. Yes, I did edit it but if you read my edit carefully you'll see that I was fair and covered the original scheme of your answer (which is right to some degree: the API doesn't let you do that. But there's absolutely an easy way to do it via a tool, and if the developer goes down the path of implementing it programatically, I left the caution you originally put there). – Ofer Zelig Nov 12 '18 at 10:01
-
@OferZelig Sorry, I could not add a note to edit. I guess because it was a rollback, it has only the default description. Therefore I added the comment addressed to you. You mistook me as the owner of this answer. This is not my answer. My answer is the second one which mentions the tool. In your edit you are modifying the answer completely and while doing that you are using my answer. – Nuri Tasdemir Nov 12 '18 at 19:40
-
@OferZelig I understand your point of view. You made the change in order to make the accepted answer more complete and true. However, if that was the way to go, IMHO there should be just one answer for each question. And everyone should cooperatively edit that answer. But it is not the case. It is not required that the accepted answer is the most complete one. A new answer may outperform an accepted answer over time. That's why we have upvotes and downvotes. And we have badges such as https://stackoverflow.com/help/badges/62/populist. IMHO this is the way SO works. – Nuri Tasdemir Nov 12 '18 at 19:55
-
@NuriTasdemir correct, I mistook you as the owner of the answer. Now that I see that your answer is here below, I understand your motives of keeping this accepted answer as wrong. You want people to scroll down, find yours and upvote it. Which I find a bit awkward... because people who won't read through will be misled to think they can't accomplish this task at all. BTW I didn't copy from you. I think this debate is a matter for Meta: is it OK to keep a clearly wrong accepted answer for the sake of other answers to gain upvotes, rather than correcting the wrong answer. – Ofer Zelig Nov 13 '18 at 05:23
-
3@OferZelig... Interesting discussion! I have updated my answer and informed folks to look for Nuri's answer. Hope this helps. – Gaurav Mantri Nov 13 '18 at 05:38
I couldn't find the rename functionality in the storage explorer v1.15.1 but I did use the clone option to create a copy and delete the old container.

- 3,110
- 28
- 39
No. You can't rename a blob container in Windows Azure.
Code to copy from the old storage to the new storage
AzCopy /Source:https://oldstorage.blob.core.windows.net/oldstorage /Dest:https://newstorage.blob.core.windows.net/newstorage /SourceKey:sourcekey /DestKey:destkey /S /XO

- 375
- 6
- 15
This RenameBlob method will allow you to rename folders or files in an Azure container.
- album1/image1.jpg -> album2/image1.jpg
- album1/image1.jpg -> album1/image2.jpg
HTH
public class AzureStorageService
{
readonly CloudStorageAccount _storageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString);
public void RenameBlob(string oldName, string newName)
{
var blobClient = _storageAccount.CreateCloudBlobClient();
var container = blobClient.GetContainerReference("MyContainer");
var blobs = container.GetDirectoryReference(oldName).ListBlobs();
foreach (var item in blobs)
{
string blobUri = item.Uri.ToString();
var oldBlob = container.GetBlockBlobReference(blobUri);
var newBlob = container.GetBlockBlobReference(blobUri.Replace(oldName, newName));
newBlob.StartCopyFromBlob(oldBlob);
oldBlob.Delete();
}
}
}

- 9
- 2
-
-
2Also, I don't know if it's a good idea to delete the old blob while the cop operation is in progress. Just because you returned from `StartCopyFromBlob` doesn't mean the operation completed. – Dave Van den Eynde Mar 08 '16 at 08:46