Wednesday 6 April 2022

Azure Storage Account - Part One - What Is Blob

 

Introduction

In this module, we will learn the following concepts.

  • What Azure Storage Account is and how to access it
  • Create your very own Storage Account in Azure
  • Access keys of Storage Account
  • Container and Blob
  • Manage your blobs from Azure portal

So, let’s start.

What Azure Storage Account Is and How to Access It

Azure storage data objects hold blobs, files, queues, tables, and disks. You might notice that whenever you are creating an App Service, a new storage account has been created by the same or related name under the same resource group. It is holding the disks for the App Service. Like this, you can create your own storage account to store the data (files or blob).

Basic features of Azure Storage Account
  1. Highly available and durable
  2. Encrypted and secure
  3. Scalable
  4. Accessible from anywhere in the world

To access the Storage Account, go to your Azure portal. In the search bar, search for the storage account or you may find the link on the left sidebar. Click on the link to navigate to your Storage Account page.

Azure Storage Account - What Is Blob

Here, you can find all the storage accounts that have been created under your subscription.

Azure Storage Account - What Is Blob

Click on each storage account to access them. Or you can create your own new Storage Account by clicking on the (+ Add) button on the top left side of the blade.

Generally, there are three types of Storage Accounts in Azure.
  1. General-purpose v2 accounts
  2. General-purpose v1 accounts
  3. Blob storage accounts

You will find these options while creating a new storage account from the portal.

TypesSupported ServicePerformance TiersAccess TiersReplication options
General-purpose V2Blob, File, Queue, Table, and DiskStandard, PremiumHot, Cool, ArchiveLRS, ZRS, GRS, RA-GRS
General-purpose V1Blob, File, Queue, Table, and DiskStandard, PremiumN/ALRS, GRS, RA-GRS
Blob storageBlobsStandardHot, Cool, ArchiveLRS, GRS, RA-GRS

Purpose of Blob Storage

  1. To store files for distributed system
  2. To stream audio and video files
  3. To store data for back and restore, which will take place at the time of recovery and archiving
  4. To access data for Azure-based apps (Azure Logic Apps)

Key things to be remembered

  • The storage account name should be within 3-24 characters and it can hold only numbers and lowercase characters only.
  • Name of your storage account should be unique. Two storage accounts with the same name in whole Azure cannot be created.

Create Your Own Storage Account in Azure Portal

To create a new storage account, click on the (+ Add) button on the Storage Account blade, as shown in the last image. This will lead you to the creation blade of an Azure Storage Account. Here, we will create a new storage account of type blob.

Kindly refer to the following steps to create your storage account.

  1. In the creation blade, first choose your subscription and resource group, under which your storage account will be created.
  2. Provide a unique storage name.
  3. Choose your location from the location drop down.
  4. Choose Blob from the Account Kind. Once you choose “Blob storage” from the drop down automatically “Premium” will be disabled, as Azure does not support premium for “Blob storage”.
  5. Set your replication and access tier and click on the “Review + Create” button underneath.

Azure Storage Account - What Is Blob

It will take a few minutes to create a new storage account. After creation, you can find the created account name in the Storage Account blade.

Now, click on that to access the account.

Access Keys of Storage Account

To access your storage accounts from outside, you need connection strings, which are provided by Azure for an individual storage account. To access these connection stings, go to your storage account and click on the “Access Keys” from the left side menu. Or, you can search from the top search bar.

There, you will find your storage account name and couple of key (512 bit)/connection string combination. Use the refresh buttons to regenerate the keys and connection strings. Regenerating your access keys will not interrupt your application. It's Microsoft’s recommendation to change the keys regularly.

Azure Storage Account - What Is Blob

Use these connection strings to access your storage account from outside.

Container and Blob

In your storage account, files are stored as a blob and they are grouped in a container. Account stores containers and container stores blobs.

Azure Storage Account - What Is Blob

Manage Your Blobs From Azure Portal

Within the “Blob Service” header, you will find the option called “Blob”. Using this, you can manage your blobs from Azure portal. On the first page, i.e., the container page, you can add, edit or delete any container of your choice.

Click the (+ Container) button to add a new container. Put the container name and choose the access of the container you want. Apart from private, you can directly access the blob, but in most of the scenarios, we choose private blobs, which is not accessible directly. We have to get it using the key provided in the “Access Key” section.

After creating a container, you can view the list of containers in a grid. Click on the container name to access it.

Here in the blob blade, use the “Upload” button to upload any file into this container. A blob can be up to 195 GB in total size. After uploading the file, you can manage it from the same page.

Relative Path

Azure Storage Account - What Is Blob

Acquire lease
 
You might find an option called “Acquire lease” on the top of the blobs grid. If you select the Acquire lease for a particular blob, you cannot edit the blob until you break it. But you can edit with the help of Lease Id, which will be populated while you are enabling the Acquire lease for the file.

Generate SAS

To download the private blob externally, we have to generate a SAS token. You can set the validity of the generated SAS token. By default, it is 8 Hr. You can also set the permission to Read, Create, Write & Delete.
 
Azure Storage Account - What Is Blob

Share the SAS URL to the users to view the file.

In the next session, we will cover how to upload or download a blob from C# using Visual Studio.

No comments:

Post a Comment