Steps to Create a Storage Account, Containers and File Share in Microsoft Azure
In this blog post, I dive into the world of Azure storage, uncovering the essentials of storage accounts, containers, and file sharing. Join me as we embark on a journey to understand the intricacies of Microsoft Azure and learn how to leverage its powerful storage capabilities.
Key Highlights:
๐น Demystifying Azure storage accounts and their significance
๐น Exploring different redundancy options for data durability and availability
๐น Seamlessly scaling storage capacity to meet dynamic requirements
๐น Step-by-step guide to creating containers for efficient data management
๐น Unveiling Azure File Share for simplified file sharing and collaboration
๐น Practical walkthrough: Creating your own storage account, containers, and file share.
Creating a Storage Account
A storage account in Azure is a container for storing various types of data, such as files, blobs, queues, tables, and disks. It provides a scalable and durable storage solution for applications and services running in the Azure cloud environment. Here are some key points about Azure storage accounts:
Data Redundancy: Azure storage accounts ensure data durability and availability through redundancy options.
Scalability: Azure storage accounts can seamlessly scale to accommodate varying amounts of data.
Data Access: Azure storage accounts provide REST-based APIs for easy data access from anywhere.
Data Security: Azure storage accounts offer encryption, access control, and integration with Azure Active Directory for data security.
Storage Types: Azure storage accounts support Blob storage, Files, Queue storage, and Table storage for different data scenarios.
Integration and Services: Azure storage accounts integrate with other Azure services for seamless application integration.
Monitoring and Management: Azure storage accounts provide monitoring, logging, and management capabilities for efficient storage usage.
Basic
First search for the Storage Account
Fill in the basic details
Advanced
Initially, things are default but in Blob storage we need to go with Hot option
Networking
In Network access -> 1st option is default but In 2nd option, we can also select our Vnet but for I am going with default Enable public access from all networks.
For Network routing, Microsoft network routing is best
Data Protection
I am going with by default configuration
Encryption
I am going with by default options
Review
My Storage account is ready now
Containers (Similar like AWS S3)
Containers: Containers are a logical unit of organization within a storage account. They are used to store and manage collections of blobs (Binary Large Objects) such as files, images, videos, documents, or any other type of unstructured data. Blobs within a container can be accessed individually, and they are typically addressed using a unique URL. Containers provide a way to group related blobs and manage access permissions at the container level.
Creating Container
Right now we have made this public but if anyone wants to change it to private, in that case we need to generate SAS
Select Permission (Read only option)
Time
Allowed IP
Protocols
Uploading file
I have uploaded an image file
It's like S3 there we can upload inside the container and every uploaded item has a URL. Download and Retrieve anywhere on the web.
We can also undelete the file as per the selected backup duration
File Shares
File Shares: File shares in Azure Storage provide shared access to files through the Server Message Block (SMB) protocol. They are designed to be accessed concurrently by multiple clients, making them suitable for scenarios where shared file storage is required. Azure file shares can be mounted as network drives on Windows, Linux, and macOS systems, enabling easy file access and sharing across different platforms.
I have uploaded a file here
I am going to create 2 VMs with different regions and I am creating files inside the VMs which are synchronized with each other.
I have accessed my First VM Server-1
I am going to paste the File share script in my both the VMs
- Create the mount directory:
sudo mkdir /mnt/demoshare1
This command creates a directory named "/mnt/demoshare1" where the Azure file share will be mounted.
- Create the "/etc/smbcredentials" directory if it doesn't exist:
if [ ! -d "/etc/smbcredentials" ]; then
sudo mkdir /etc/smbcredentials
fi
This checks if the "/etc/smbcredentials" directory exists and creates it if it doesn't.
- Create the storage account credentials file if it doesn't exist:
if [ ! -f "/etc/smbcredentials/storage80.cred" ]; then
sudo bash -c 'echo "username=storage80" >> /etc/smbcredentials/storage80.cred'
sudo bash -c 'echo "password=iSJFi/nx3xOUaCl2U/cIk4Zu8KuuMPLt3oxmhrfRq31MgBjtaaVyVuzfQD2FqdVFycrEQaj5ptGo+ASt5cdfxQ==" >> /etc/smbcredentials/storage80.cred'
fi
This creates the storage account credentials file "/etc/smbcredentials/storage80.cred" if it doesn't exist. It contains the username and password for accessing the Azure file share.
Set the permissions for the credentials file:
sudo chmod 600 /etc/smbcredentials/storage80.cred
This command sets the permissions of the credentials file to restrict access only to the owner.
- Add an entry to the "/etc/fstab" file for automatic mounting:
sudo bash -c 'echo "//storage80.file.core.windows.net/demoshare1 /mnt/demoshare1 cifs nofail,credentials=/etc/smbcredentials/storage80.cred,dir_mode=0777,file_mode=0777,serverino,nosharesock,actimeo=30" >> /etc/fstab'
Azure file sync agent needs to be installed on the VM for synchronization
Server-1
Server-2
I have added hello using my Server-1 (VM Central India)
I can access this in my Server-2 (VM Us East)
Azure Panel
In my Azure panel, I can see all the files
Thank you for reading my blog, and I hope you find it informative and inspiring. If you have any feedback or questions, please feel free to reach out.
.
.