I was just wondering if it is possible to reference azure blob storage data in a SQL Azure table column?
For example, say I have a table called Users in my SQL Azure database, one of the columns in that table is UserImage
, and instead of creating UserImage
as a varbinary(MAX)
and storing the image data directly in the table, I would instead like to store the image data in blob storage, get a reference to the blob data and store that reference in the UserImage
(varchar
??) column in the database, and then somehow, when reading the rows from the Users table, access the associated image data from blob storage using the reference to that data.
I am asking this because blob storage is considerably cheaper to use than binary/blob data directly within SQL Azure.
The possibility to query information on blob storage and other sources easily with a Serverless Pool has many uses. One of them is ad-hoc analysis queries, and the UI feature to view the result in many different ways contributes even more to this.
Users or client applications can access objects in Blob storage via HTTP/HTTPS, from anywhere in the world. Objects in Blob storage are accessible via the Azure Storage REST API, Azure PowerShell, Azure CLI, or an Azure Storage client library.
You should be able to store the URL to the image in SQL Azure and have the client program parse the URL and display the image from the URL.
I can't think of any way to have SQL Azure directly go to Blob storage, nor do I see a need for this as most client programs will be able to work with the URL as well as with the BLOB.
You should just store the image Url in SQL Azure, here is a short snippet to upload a image to the Blob Storage and get its Url:
// Fake stream that contains your image to upload
Stream data;
// Get a handle on account, create a blob service client and get container proxy
var container = Account.CreateCloudBlobClient()
.GetContainerReference("my-fake-container");
// Create a blob in container and upload image bytes to it
var blob = container.GetBlobReference("my-fake-id");
blob.Properties.ContentType = "image/jpeg";
blob.UploadFromStream(data);
// Get your iage Url in the Blob storage
var imageUrl = blob.Uri;
You now just have to store imageUrl in your row.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With