简体   繁体   中英

Azure storage blobs, C#, how can I determine what blob is currently in use?

I am writing console app to list and snaphot/restore azure blobs. As I understand, I can make snapshot, then fully turn off the machine(from azure portal, with deallocate), and copy some snapshot back with overwrite

In this example I'm getting blobs into a collection:

        // get storage account based on credentials
        CloudStorageAccount storageAccountObj = new CloudStorageAccount(creds, false);

        // move all blobs to collection
        CloudBlobClient blobClient = storageAccountObj.CreateCloudBlobClient();
        var containers = blobClient.ListContainers();

        List<CloudBlob> blobsArray = new List<CloudBlob>();
        foreach (var container in containers)
        {
            foreach (var listBlobItem in container.ListBlobs())
            {
                var blobItem = (CloudBlob)listBlobItem;
                blobsArray.Add(blobItem);
            }                    
        }

        // display blobs
        DisplayBlobCollection(blobsArray);

But there are blobs with same names but different ETag's:

在此处输入图片说明

How can I determine what blob is currently in use by virtual machine?

How come you get blobs with same name? Pring out the container name too, it may give you a clue which one is in use by the VM. There cannot be two blobs with same name within the same container.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM