Reference blob storage data in SQL azure

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.


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.