1 Azure Street

How to download image from Blob Storage by URL?

I was working on a project where I had to download images from blob storage by URL, and didn’t know how! but after digging for a while, found an easy way and thought to share it with you..
but first things first, let’s, in a nutshell, describe what is Azure Blob Storage?
Azure Blob storage is Microsoft’s object storage solution for the cloud. Blob storage is optimized for storing massive amounts of unstructured data, such as text or binary data.
Blob storage is ideal for:
  • Serving images or documents directly to a browser.
  • Storing files for distributed access.
  • Streaming video and audio.
  • Writing to log files.
  • Storing data for backup and restore, disaster recovery, and archiving.
  • Storing data for analysis by an on-premises or Azure-hosted service.
We will talk in details later about Azure Storage Solutions, and how to utilize it to better serve your needs. 
but basically to deal with Blob Storage with .Net stack, you’d need
then you would need to download WindowsAzure Storage package from nugget
 
Blob storage exposes three resources: your storage account, the containers in the account, and the blobs in a container. The following diagram shows the relationship between these resources.

Storage Account

All access to data objects in Azure Storage happens through a storage account. For more information, see About Azure storage accounts.

Container

A container organizes a set of blobs, similar to a folder in a file system. All blobs reside within a container. A storage account can contain an unlimited number of containers, and a container can store an unlimited number of blobs. Note that the container name must be lowercase.

Blob

Azure Storage offers three types of blobs — block blobs, append blobs, and page blobs (used for VHD files).
  • Block blobs store text and binary data, up to about 4.7 TB. Block blobs are made up of blocks of data that can be managed individually.
  • Append blobs are made up of blocks like block blobs, but are optimized for append operations. Append blobs are ideal for scenarios such as logging data from virtual machines.
  • Page blobs store random access files up to 8 TB in size. Page blobs store the VHD files that back VMs.
below code is a simple snippet for uploading the image to the blob storage
but when you download the image, the sample provided by Microsoft will deal with downloading images from the container using Image name so if you want to download it using URL, the below snippet will help you get it done
 

Related Posts

Leave a comment