This is my fourth article on learning Azure. I recommend going through the previous three articles (links are given below) on Azure -
In this article, I will explain about Storage Accounts (Storage Accounts can hold hundreds of terabytes of data) and we will see how we can use Azure Storage as a place to keep uploaded files for our web application and how we can allow users to download files from storage by creating and handling out what is known as a shared access signature (SAS).
I will specifically explain about creating Storage Account, Containers in Microsoft Azure.
Types of Storage
In Azure, creating a storage account allows us to work with four different Storage Services.
- Blob Storage Service – Blob is known as Binary Large Object, however we can store any type of file in Blob storage (Large files & small files). We can store binary files like movies and images or text files like code files or script files.
- Table storage – This is a no-SQL database service which is used for storing key-value pairs.
- Queue storage – Queues allows to store and receive messages i.e. they allow to put a buffer between the application and the back-end services.
- File storage – It allows to setup SMB files shares in the cloud. This type of storage is very useful when you have existing application which you want to port to Azure and your existing application uses file shares.
Accounts, Containers and Blobs
To use Blob storage, we will first create a new storage account in Azure. As part of that setup, we will first provide a name and since Blob storage is addressable over HTTP, the name will become the first part of the domain that we use to get to the storage.
Firstly, we need to create a container before creating a Blob. A container is like a folder for the blobs. Each container can have its own name, settings, and permissions and then the Blobs we create will be in one of the containers that we have created.
Let’s create the Storage Account and other related things in Azure portal.
Creating a Storage Account
Inside the Azure portal, go to Storage accounts and click on Add.
The various configurations settings are,
- You have to give a storage account name.
- Deployment Model – Resource Manager or Classic
- Account kind – General Storage or Blob storage
- General Purpose – It gives access to Table storage and Queue storage and to all other types of storage
- Blob storage – It will allow you to pick an access tier of Cool or Hot. If you have the Blobs, which you want to store, but they are not accessed very frequently, you can choose Cool tier and vice versa.
- Performance – Standard or Premium etc.
Once you click on Create button, a new storage account is created in a few seconds, as shown below,
Creating a Container
Now that the storage account has been created, we will see how we can create containers inside that storage account.
Click on the storage account and you will some of the basic settings and it will allow you to access Blob storage, File storage, Table storage and Queue storage.
So, let’s click on Blob storage and create a new container. I have given the name of the container as “images” to store some images and other option is Access Type having options as Private, Blob and Container.
Once you click on Create, a container with the name “images” will be created and when you click on this container, you will see the button to upload the Blobs, as shown below,
When you upload a blob, which can be done by just selecting a file from the local file system, you get an option called “Blob Type”. There are three types of blob types and you have to select one of these while creating a blob.
- Block blob – It is just like the files on your file system like images, movies, XML files etc.
- Page blob – It is like storing VHD files for the virtual machine.
- Append blob – It is a special kind of Block blob and it is optimized to write always to the end of the blob. Therefore, it is good for files like logged files, where you always want to append at the end of the file.
Summary
In this article, we saw how to create Storage Accounts, Containers and Blobs in Microsoft Azure from Azure Portal. In the next article, I will show how we can upload blobs using C# Applications.