1
votes

I am updating a system that had all of it's files stored inside of sql server.

It's going from an on prem server to a Azure webapp.

My questions are:

  1. I think I should be using a storage blob for these files. Is that correct or is there a better option inside of Azure that I should be using?
  2. Is there a quick way to migrate files from sql to that blob?
  3. For storage purposes, do I write the file to the blob and then store the hyperlink to that file?
  4. The staging environment gets updated with the latest data from production when they do a release, is there a way to migrate storage blob to a different resource group for when they do this?
2

2 Answers

2
votes
  1. Yes, I would use blob.
  2. Quickest way would be a quick powershell or cli script or console app to pull the files from the database and upload them to blob.
  3. I don't store the entire hyperlink to the file in the database, just the path. That way the storage account and container can be environment configurations.
  4. I would recommend against doing this... we've found since we started doing automated continuous deployment, we haven't had a reason to move backwards, which has eliminated a lot of effort. That being said, AzCopy is a utility that allows you to do server-side copy of blobs between storage accounts (along with many other types of source and destination if needed). That should do what you need.
1
votes

To answer your questions:

I think I should be using a storage blob for these files. Is that correct or is there a better option inside of Azure that I should be using?

That's correct. Blob storage is meant for this purpose only.

Is there a quick way to migrate files from sql to that blob?

I'm not aware of any automated way to do that. What you would need to do is read the binary data from SQL Database and then create a stream out of it and upload that stream. You can use Azure Storage SDK for uploading purpose.

For storage purposes, do I write the file to the blob and then store the hyperlink to that file?

Under normal circumstances, it is recommended approach however considering you have a need to create a staging environment that will be a copy of production environment (including database I am assuming), I would recommend you store 2 things in your database: blob container name and blob name (or you could store relative URL e.g. <container-name>/<blob-name>). Assuming you keep storage account name somewhere in the configuration file, you can create the URL dynamically using https://<account-name>.blob.core.windows.net/<container-name>/<blob-name> pattern.

The staging environment gets updated with the latest data from production when they do a release, is there a way to migrate storage blob to a different resource group for when they do this?

Azure Storage provides Copy Blobs functionality using which you can copy blobs from one blob container to another in same or a different storage account. You can use that to copy data from production environment to staging environment.