Create SnapShot with Separate Metadata every time

Swapnil Mahalinga Mahajan 1 Reputation point
2020-09-10T13:24:16.537+00:00

I am creating Blob and next to it creating snapshot for CloudBlock Blob using .net. I also set Metdata while creating blob. But Metadata wont get set for each snapshot separately. Metadata overrides base Blob and also other snapshots. I want to create separate metadata for each snapshot.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,190 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,405 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Adam Sherif 1 Reputation point
    2020-09-10T13:33:49.6+00:00

    Metadata overrides base Blob and also other snapshots. I want to create separate metadata for each snapshot. فقرات


  2. Sumarigo-MSFT 43,321 Reputation points Microsoft Employee
    2020-09-11T10:47:06.317+00:00

    When you create a snapshot of a blob, the blob's system properties are copied to the snapshot with the same values. The base blob's metadata is also copied to the snapshot, unless you specify separate metadata for the snapshot when you create it. After you create a snapshot, you can read, copy, or delete it, but you cannot modify it.

    // Create a snapshot of the base blob.
    // You can specify metadata at the time that the snapshot is created.
    // If no metadata is specified, then the blob's metadata is copied to the snapshot.
    await blobClient.CreateSnapshotAsync();
    }
    catch (RequestFailedException e)
    {
    Console.WriteLine(e.Message);
    Console.ReadLine();
    throw;
    }
    }

    For more information,please refer to this article.

    Refer to this article which gives some idea on your scenario.

    Additional information: Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the base blob metadata to the snapshot. If one or more name-value pairs are specified, the snapshot is created with the specified metadata, and metadata is not copied from the base blob. see here for more information

    Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information.

    Setting and retrieving properties and metadata for Blob service resources

    Hope this helps! Kindly let us know if the above helps or you need further assistance on this issue.

    ----------------------------------------------------------------------------------------------------------------------------------------

    Please don’t forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.