Basics Of Azure Storage

In this article, I will explain the basics of Azure Storage and in the coming series I will cover the description, implementation and best practices of each service.

Introduction

In traditional server approach we mostly store the images with the project package or in a file location in server and every time we publish those we ship our images also in all the servers.

In the world of cloud we store all files (images, logo etc.) in a common location, so that all the instances of your application can access the data from centralized location. From the maintenance point of view it is very helpful as we have to only maintain in one location, we don’t need to visit all the servers  to update the files. In azure we store files in Azure Storage.

Moreover with the help of CDN the availability of the files will increase.

In this article, I will explain the basics of Azure Storage and in the coming series I will cover each service’s description, implementation and best practices. Hope you will enjoy.

To get more grip on the topic let’s begin with an example, you have created an application and you choose to deploy the application to Azure’s Cloud Service or Web app (Other services Azure provides). Here my server location will not be fixed as every deployment will spin up a new VM in case of cloud service, so it will be difficult to identify the remote web server location. In these circumstances we mostly use Azure storage to store our files. We can use CDN also to get the files from the nearest available server and this will help to increase performance.

Types of Storage services

Azure storage is a secure way to store files on cloud, we can restrict the access of a storage account using Shared Access Signature (SAS) you will see more about SAS in later section. Azure Storage provides 4 types of storage services:

  • Blob
  • Queue
  • Table
  • File Service

Types of Storage Account

Azure is a pay as you go service, so we should always keep in mind about the cost factor. We can differentiate the storage account in two types:

Cost Factors

As we were talking about the cost factor related to azure we need to see some of the cost factors which will affect your azure subscription bill.

  • Storage Capacity – Capacity you use for your data.

  • Replications scheme– We can replicate our storage to multiple geo location for two major reasons; firstly, risk factor server crashing and other one will be the performance as application can access the nearest location.

  • Storage transaction – No of transaction (read write operation) made on the storage account. We can access <> transaction per month free after that it will cost you subscription.

  • Data Egress – Amount of egress data out or accessed by application in other region.

Note: I took this information from the azure documentation available in Storage documentation,

For more and updated details on pricing you can refer the Microsoft pricing.

Create a storage account

Steps to create a new storage account from the new preview portal is as follows:

  1. Login to Azure Portal with your credentials.

  2. Click New, Data + Storage, then Storage Account,

    Account

  3. New Blade will open for Azure Storage Account. You can check the latest pricing tiers. It has two deployment models:

    • Classic – This is our old traditional way of creating storage using management portal.

    • Resource Manager – This is a nice way to manage the resource and can correlate the resources if required. It give a whole lot of options to create the stuffs.

    Storage Account

  4. For now we will select Classic and click create then a new blade will open. In this blade you have to provide the following details:

    • The storage name of the storage account.
    • The pricing tier for the storage.
    • Resource group – We can think it as a logical grouping\collection of storage.
    • Subscription: On which subscription you want to create the storage.
    • Last two options are the location (datacenter on which storage will create) and the diagnostic option available.

    Enter details

  5. Once you enter all the details hit create then in dashboard you will find a new tile as in the following:

    Create storage account

  6. Once storage is created you can click on the tile and can do the changes in setting or can browse options.

Storage account endpoints

We can access our storage using Storage account endpoints. Every storage object has a URLs to access which is a combination of azure storage account name as sub domain and domain name as the services together they form a unique URL for a storage object.

http://<storage account name>.<service name>.core.windows.net

For example, if your storage account name is testStorage, then the default endpoints for your storage services are as follows:

  • Blob service: http://testStorage.blob.core.windows.net
  • Table service: http://testStorage.table.core.windows.net
  • Queue service: http://testStorage.queue.core.windows.net
  • File service: http://testStorage.file.core.windows.net

Storage access keys & connection string

When you create azure storage, you will get an access key, as we saw in the Create Storage section. These storage keys are encrypted unique values which you will use to access your storage. Once you click on the tile you will find all the details in the settings blade. Click on keys that will give you all the key details.

Setting

Regeneration of key effect

Suppose if your storage key is leaked. You don’t need to worry about you can regenerate a new key for the storage. In the manage keys blade check the regenerate buttons present at the top of the blade.

Manage keys

When we regenerate a new key it effects the currently deployed version of your application or the Virtual Machine where old key was updated. So you need to redeploy your stuff. The following are some points when you regenerate a new key.

Some important concepts required going forward

The following are few topics which will require going forward in the journey of Azure. So I believe that we should know these topics.

Geo Replication

By name you might have guessed it properly, it basically means that we are replicating the content to multiple geo location mostly in different data centers. This is a wise choice because it helps our application to get protected from the failure, crash or nature’s chaos (earthquake, storms). Keeping the data in multiple location will provide a high availability, risk of data loss, fail over recovery, etc. Although this will add additional cost to our wallet.

SAS

SAS (Shred Access Security) is the security mechanism which comes out of box with storage. Azure services are mostly accessed using APIs which are wrapped with an access provides which allows a resource access request if you have the access token these makes the things pretty secure. We use SAS not only in Azure storage but also in Azure Service Bus. We will look into its working and options in coming articles of this series.

Data Egress

This mean the amount of data going out of azure data center. Most of the costing related to the azure storage depend on this unit that is why we should understand this point.

Affinity group

Affinity are group of locations or we can say the hard disk space in the data center. Let’s take an example and try to understand the need of affinity group. In the world of cloud we never get to know the server where our application will be hosted and the files in storage. Keeping the application, data, etc. in same affinity group tells the azure to keep them in the nearest possible location so that we can get a higher performance. It can be in different racks nearby or can be in the hard disk next to each other we cannot predict. So this is also a nice idea to keep the application in the same affinity group.

Service co-location with an affinity group

Helpful tools

For azure storage you can use azure storage emulator and get the same sort of advantage as the cloud will provide but offline.

Please download it from the link, storage emulator is part of Azure SDK package.

Next will be a storage explorer which will help you to access the storage account. You will find lot of products available in market and you can pick any one of those I use is Neudesic Azure storage explorer. You can download it from the following link.

We will discuss about all the services related to Azure storage in the coming sessions.