Search code examples
azuremetadataazure-blob-storageversioning

Azure Blob Storage versioning - Use a metadata property other than filename for versioning


Currently for files with the same name when you upload them in sequence, they get stacked one on top of the other. Can we control this version stacking based on metadata attributes?

So a sequence like the below will create 3 versions of the same document

filename "test.txt" with metadata attribute "x" - attempt 1 - creates version 1

filename "test.txt" with metadata attribute "x" attempt 2 - creates version 2 of above

filename "test.txt" with metadata attribute "y" attempt 3 - creates version 3 of above

But the desired versioning in our case is as follows:

filename "test.txt" with metadata attribute "x" - attempt 1 - should create version 1

filename "test.txt" with metadata attribute "x" attempt 2 - should create version 2 of above 

filename "test.txt" with metadata attribute "y" attempt 3 - should create version 1 independent of above stack

This is because we have a date attribute (x, y) that needs to control the versioning rather than purely based on filename alone.


Solution

  • Can we control this version stacking based on metadata attributes ?

    Simple answer is that you can't. With system provided blob versioning, a new version will be created anytime a blob is updated. You cannot control on which parameters (metadata in your case) the versioning will depend on.

    If you want versioning based on some logic other than blob being updated, you will have to roll out your own solution.