I really don't have experience with this, and I'm, wondering what's the best practice for doing azure storage handling properly.
So, when we upload a file to Azure storage, I'm creating an entry in our MSSQL database table that will reference that file. Because I read that azure blobs don't really have identifiers, and they are using URLs as identifiers, and we don't have something like FileId, how do we manage that when in the future we want to migrate that storage? Should we add custom metadata that will help us what that file is, or is there another approach?
Thanks!
Every blob is uniquly identified by URL Like below
https://StorageAccountName.blob.core.windows.net/ContainerName/FileName.extension
You can add a custome column for URL's in your MSSQL Database table and update the FileURL for all the blob.
InFuture if you planning to Move the files from one storage account/Container
to another Storage Account/Container
your StorageAccountName
and BlobName
will be change for that URL.So you only need to update the the two thing in that URL(String).
You can use .NET, AzCopy, and Azure CLI to migrate files between Azure storage accounts.You can refer this document to achive the same.
You can update the URL(String) Using the below SQL query.
UPDATE
table_name
SET
column_name = REPLACE(column_name, 'old_string','new_string')
WHERE
condition;
For more information you can refer this Doucment