Gennady G
Gennady G

Reputation: 1076

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:

enter image description here

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

Upvotes: 0

Views: 242

Answers (1)

astaykov
astaykov

Reputation: 30903

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.

Upvotes: 1

Related Questions