Azure storage offers four different service to store data
- Blobs
- Table
- Queue
- File
What is Blob and When to choose it?
Blob refers to Binary Large OBject.
Blob storage can be opted for storing large amounts of unstructured object data such as text , video’s, audio’s ,images and binary data.
Types of Blobs
1. Block blobs
- These are blocks of data that can be managed individually.
- Can be used to store text and binary Data
2. Append blobs
- These are like block blobs optimized for append operations
- Ideal for logging data
3.Page blobs
- These are optimized for random read and write access
- can be used for storing disk files
Blob Access Tiers
- Hot → can be used when data accessed frequently (can be set at account level)
- cool → can be used for infrequent access of data and when the data is stored for at least 30 days (can be set at account level)
- Archive → can be used for rare access of data and when the data is stored for at least 180 days(can be set at blob level)
Before archiving , note that data will be inaccessible until it is rehydrated back to hot or cool which may take several hours.
storage cost → archive < cool < hot
Access cost → archive > cool > hot
Containers in blob storage
Containers are used to organize blobs, just like a folder.
Container access level:
- private ( no anonymous access)
- blob ( anonymous read access for blobs)
- container ( anonymous read access for containers & blobs)
CLI commands for basic blob operations:
Name of resource group — rgname
Name of storage account — samplestracc
Name of Container — samplecontainer
Name of blob — samplefile
- create storage account
az storage account create — name samplestracc — resource-group rgname — location WestUS — sku Standard_LRS - create container in storgae account (access level will be private)
az storage container create — account-name samplestracc — name samplecontainer - Create blob in container (access tier will be hot)
az storage blob upload — account-name samplestracc — name samplecontainer — name samplefile.txt - Set access level to access blob (access level -blob)
az storage container set-permission — account-name samplestracc — name samplecontainer — public-access-blob - List all blobs under a container
az storage blob list — account-name samplestracc — name samplecontainer — output table - Download blob
az storage blob download — account-name samplestracc — name samplecontainer — name samplefile.txt — file samplefile.txt