DEV Community

Cover image for Secure and Scalable File Sharing with Azure Files: A Step-by-Step Guide
Chinonso Ukadike
Chinonso Ukadike

Posted on

1

Secure and Scalable File Sharing with Azure Files: A Step-by-Step Guide

Secure and Scalable File Sharing with Azure Files: A Step-by-Step Guide

Introduction

In today's fast-paced digital world, businesses rely heavily on secure and efficient file-sharing solutions to collaborate effectively. Whether it's storing project documents, sharing reports with teams, or ensuring critical files are backed up, having a reliable, cloud-based file system is crucial.

Azure File Storage provides a fully managed, highly available, and scalable solution that allows organizations to store and access files from multiple locations. With features like snapshots for file recovery and network security restrictions, Azure Files is an excellent choice for organizations that need enterprise-grade file storage without the complexity of managing physical servers.

This guide will walk you through creating an Azure File Share, configuring snapshots for data protection, and securing access to enhance security and compliance.


Use Case: Cloud-Based Document Management for Remote Teams

Imagine a consulting firm with employees working remotely across different locations. The firm needs a centralized document storage system where consultants can access project files, upload reports, and collaborate in real-time with the following requirements:

  1. Files should be easily accessible from different devices and locations.
  2. Snapshots should be enabled to prevent data loss due to accidental deletion.
  3. Access should be restricted so only authorized users from the corporate network can retrieve sensitive documents.

With Azure Files, the company can set up a secure and scalable document repository that ensures smooth collaboration, high availability, and data protection.


Getting Started

Now that we understand the importance of Azure File Storage and its benefits for remote teams, let's dive into the step-by-step implementation process. We will cover:

  • Creating an Azure File Share for centralized document storage.
  • Configuring snapshots for file protection and recovery.
  • Restricting access to ensure only authorized users can retrieve sensitive files.

Let’s get started!


Step 1: Create and Configure an Azure Storage Account

To use Azure File Storage, we first need to create a Storage Account optimized for file shares.

1.1 Create a Storage Account for File Sharing

  1. Search for "Storage Accounts" in the Azure Portal and select it.
    Image description

  2. Click + Create on the storage account screen.
    Image description

  3. Under Resource group, select Create new, provide a name, and click OK.

  4. Enter a Storage account name (must be globally unique).

  5. Set Performance to Premium for fast and reliable access.

  6. Set Premium account type to File shares.

  7. Set Redundancy to Zone-redundant storage (ZRS) for better data protection.

  8. Click Review + Create and then Create.
    Image description

  9. Once deployed, click Go to Resource.


Step 2: Create and Configure an Azure File Share

Now that the storage account is ready, we can create an Azure File Share to store project documents.

2.1 Create a File Share

  1. In the Storage Account, go to the File shares section.
  2. Click + File Share.
    Image description

  3. Provide a Name (e.g., project-documents).

  4. Keep the default settings and click Create.
    Image description

2.2 Organize Files with Directories

To keep the file share structured, we will create a directory for different types of documents.

  1. Open the File Share.
  2. Click + Add Directory and name it reports.
    Image description

  3. Click Browse, select the reports directory, and click Upload to add a sample file for testing.
    Image description


Step 3: Enable Snapshots for Data Protection

Snapshots help protect files from accidental deletion or corruption by allowing users to restore previous file versions.

3.1 Creating a Snapshot

  1. In the File Share, go to the Snapshots section.
  2. Click + Add Snapshot (optional: add a comment for reference).
  3. Click OK to create the snapshot. Image description

3.2 Restore a Deleted File from a Snapshot

  1. Open the File Share and navigate to the reports directory.
  2. Locate the uploaded file, open its Properties, and click Delete.
  3. Confirm the deletion.
    Image description

  4. Go to the Snapshots section and select the latest snapshot.
    Image description

  5. Find the deleted file, right-click, and select Restore.

  6. You have two options when restoring the file:

    • Restore as a copy: Provide a new name for the file, creating a duplicate while keeping the snapshot intact.
    • Restore to overwrite the original file: If the file still exists in the directory, this option will replace it with the version from the snapshot. However, since the file was deleted, it will be restored as a new file without overwriting anything. Image description
  7. Verify that the file has been successfully restored by going to the reports directory.


Step 4: Restrict Access to a Corporate Virtual Network

To enhance security, we will restrict access so that only users within a specific corporate network can access the file share.

4.1 Create a Virtual Network

  1. Search for "Virtual Networks" in the Azure Portal and select it.
    Image description

  2. Click Create, select the resource group, and name the VNet (e.g., corporate-network).

  3. Click Review + Create, then Create.
    Image description

  4. Once deployed, click Go to Resource.

  5. In Settings, go to Subnets.

  6. Select the default subnet.
    Image description

  7. Under Service Endpoints, select Microsoft.Storage.

  8. Click Save.
    Image description

Why are we selecting Microsoft.Storage?

Service Endpoints improve security by allowing Azure services to communicate privately within Azure’s network instead of going through the public internet. By selecting Microsoft.Storage, we ensure that our Azure Storage Account (which holds the file share) is only accessible from this virtual network. This helps keep the connection secure and private, reducing the chance of unauthorized access while also improving speed.

4.2 Restrict File Storage Access to the Virtual Network

  1. Go back to the Storage Account.
  2. Under Security + Networking, select Networking.
  3. Change Public network access to Enabled from selected virtual networks and IP addresses.
  4. Click Add existing virtual network and select corporate-network and its subnet.
  5. Click Save. Image description

4.3 Verify Restricted Access

  1. Try to access the file share from a different network.
  2. You should see an unauthorized access message, confirming the restriction.

Conclusion

Through this guide, you've learned how to:

  • Set up an Azure Storage Account and File Share to store and organize files efficiently.
  • Create directories and upload files for structured data management.
  • Enable snapshots for data protection, ensuring quick recovery from accidental deletions.
  • Restrict access using Virtual Networks to enhance security and prevent unauthorized users from accessing sensitive information.

With Azure File Storage, organizations can eliminate the challenges of traditional file servers, improve data availability, and ensure business continuity. Whether handling project documentation, financial records, or sensitive reports, Azure Files provides the flexibility, security, and reliability needed for modern file management.

By implementing these best practices, your business can streamline operations, safeguard critical data, and enable seamless collaboration—all while leveraging the power of the cloud.

Image of Quadratic

The native AI interface for your structured data

Simply type in your prompt and generate insights with the latest LLMs and built-in Python functionality.

Try Quadratic free

Top comments (0)

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay