A colleague asked if there is a file versioning functionality in Azure Blob Storage. This would be something like File History in Windows, so no, but I suggested a more Cloud Native approach - Azure Functions.
For this demo I created a new Function App in Azure portal. I filled out the first step of the wizard, and left everything else by default. By doing that I also created all other resources required for this demo, including a new resource group.
Once the Function App was created, I added a new Function by going through the wizard shown below :
Here is the script I pasted in the Function :
To test if everything is working, open Storage Explorer and find Storage Account that was created in your Resource Group while creating a new Function App. Under Blob Containers, create a new Container named samples-workitems
. Adding any file to that Container will trigger the Azure Function, and you will start seeing versions of your file created.
This is just a simple demonstration of Blob Storage triggering an Azure Function, and of course the code is not really production ready.
Some things I would improve :
- Function is triggered twice (second time after the duplicate file is created)
- Content Type of the duplicate file is not the same as original
- Not tested with large files
To take screenshots I use LightShot
To record gifs I use ScreenToGif