Azure Storage is a foundational pillar of Microsoft Azure cloud platform, offering a robust and scalable solution for storing virtually any type of data. From massive amounts of unstructured data like images and videos to structured data like databases and message queues, Azure Storage provides a comprehensive suite of services to meet diverse storage needs.
Azure Storage provides a structured approach to data storage, offering four distinct services: Blobs (for unstructured data), Files (for file shares), Queues (for messaging), and Tables (for NoSQL data). Each storage account provides a unique namespace, making your data globally accessible via HTTP or HTTPS.
This article provides a practical, step-by-step guide to creating and managing blob storage within Azure. We will cover everything from initial setup to generating Shared Access Signatures (SAS) URLs for secure sharing, and even demonstrate how to change access tiers and delete your storage account when no longer needed. Let's dive in!
Prerequisites
Creating a Storage Account
Creating a Blob Container
Generating SAS URLs
Changing Access Tiers to Archive
Deleting a Storage Account
- Prerequisite
If you don't have an Azure subscription, create a free account before you begin.
- Create your Storage Account
a) Sign in to the Azure Portal and on the search bar for "storage account"
b)On the storage account page, click on "Create", this will land you on the "Basics" page
c) Under project details, click to choose your existing subscription
d) Click on "Create new" to create your resource group.
e) Scroll down to the instance details to input your globally unique storage account name, and select the region you want your storage to be deployed in.
f)To save cost, click on "standard" for your performance option. However, if you require low latency you can choose "premium"
g)For redundancy, select "Geo-redundant storage(GRS)" This option has a failover capability in a secondary region and is recommended for backup scenarios. They are also stored in two regions
h) You can select any of the redundancy options based on your needs, but for this guide, we are going with GRS.
I) Click on "Next", and scroll down to the Blob storage section.
j)On the Access tier click on "hot" to frequently access your data at any time.
(Please note that there are three types of Access tiers available: Hot, Cool, and Archive. When creating a storage account, only the Hot and Cool tiers can be seen. However, we will demonstrate how to switch to the Archive tier once the blob storage has been created.)
k) Click on Next: to configure your networking.
L) On the Networking page, go to "Network connectivity" and enable public access from all networks.
When enabled, the URL of the storage can be accessed over the internet. If it is disabled, it becomes private and accessible to you alone.
M) Scroll down to Network routing and leave the preference in the default state "Microsoft network routing"
N) Click on Next for data protection on the Data protection page, leave it in its default state. The purpose of this page is to retrieve your deleted storage within a minimum retention period of 7 days.
P) Click on next: Encryption, leave the Encryption page in its default state and click on Tags.
R) Leave the Tags page in its default state and click on "Review"
S) Click on the Review and create, you can see a summary of all that you've done. Click on "Create".
T) This will take you to the deployment page, once the deployment is complete, click on "Go to resource"
Create Your Container
Awesome!! Now that we have our storage account ready, let's get inside to create our container.
a) Click on your created storage account to have an overview.
b) Scroll to the left of your storage page, under data storage and click on "Container"
c) On your container page click on "+Container" to create your container
d) This will direct you to the page displayed below
i. Give your container a name.
ii. On the public access level, click on the dropdown and pick "Container" to grant public access over the internet.
iii. Click on the "create" button
e) Your Container is created and should reflect as seen below. To proceeds click on your container.
f) Click on the upload button to upload a picture.
G)Click on "Browse for files" or drag and drop your image
H) The above instruction will direct you to your folder on your desktop, select an image of your choice and open it to upload.
i) Your image will upload as shown below in your container.
SAS URL GENERATION
To generate SAS URL, follow the steps below:
a) Click on your uploaded image/document in your container
c) Leave the permission to "Read" for access only.
d) Now set your start and expiry date/time to grant limited access to the document for a specific period.
e) Select the "HTTP and HTTPS" under the allowed protocol category
f) Click on "Generate SAS Token and URL"
g) Copy the Blob SAS URL and share it with anyone who wishes to gain access to the document.
h) Once the link is copied, paste it into a new tab to view it as shown below.
i) Once the time and date set to view the document elapse, you will get this error if you try to access the link.
How to Change your Access Tier to Archive
Please Note: I retained my access tier as the "Hot" tier in this article. This is just to show you where to change to the "Archive" tier in the console
To store your data that will not be accessed for a long period, you can change your access tier to archive as demonstrated below.
a) Stay on the blob page and click on change tier
b) Click on the drop-down to change your access tier to your preferred choice
Delete Your Storage Account
Once you have no use of your storage account anymore, please delete it to avoid incurring unwanted charges. Simply follow the steps below;
a) To delete your Storage account, search for storage account in the search bar.
b)Then, check the box of your existing storage account and click on delete at the top-right corner.
c) Confirm delete by typing "delete" and clicking on delete.
Mastering Azure Blob Storage is fundamental for any developer working with cloud-based applications. As we have explored, creating containers provides the essential structure for organizing your data, while generating SAS URLs grants granular control over access, enhancing both security and flexibility. By understanding these core concepts, from choosing the right container access level to crafting specific SAS permissions and expiration times you are well-equipped to build robust and scalable storage solutions.
I hope this post helped, Thank you.