Sunday, August 2, 2026

Azure Storage

Azure Storage — Complete Guide for .NET Lead

Azure Storage is one of the core Azure services and is widely used in enterprise applications for storing files, images, videos, backups, logs, messages, and structured/unstructured data. Every .NET Lead should understand not only how to use Azure Storage, but also when to choose each storage type.

Official Documentation

Azure Storage Documentation


Table of Contents

  1. What is Azure Storage?

  2. Azure Storage Architecture

  3. Storage Account

  4. Types of Azure Storage

  5. Blob Storage

  6. File Storage

  7. Queue Storage

  8. Table Storage

  9. Storage Tiers

  10. Redundancy Options

  11. Security

  12. Real-Time Enterprise Architecture

  13. C# Code Examples

  14. Best Practices

  15. Lead-Level Interview Questions


1. What is Azure Storage?

Azure Storage is a cloud-based storage service that provides highly available, secure, durable, and scalable storage for different kinds of data.

Instead of storing everything in SQL Server, Azure Storage allows you to store:

  • Images

  • Documents

  • Videos

  • PDF files

  • Log files

  • Backups

  • Queue messages

  • NoSQL data


2. Azure Storage Architecture

                Users
                   |
          ASP.NET Core API
                   |
          Azure Storage Account
                   |
      +------------+------------+
      |            |            |
   Blob        File Share     Queue
      |            |            |
   Images       Shared Files   Messages
                   |
               Table Storage
               (NoSQL Data)

3. What is a Storage Account?

A Storage Account is the top-level Azure resource that contains one or more storage services.

Storage Account
      |
      +--- Blob Containers
      |
      +--- File Shares
      |
      +--- Queues
      |
      +--- Tables

Example:

companystorage001

Inside it:

images

documents

logs

backups

queue

table

4. Types of Azure Storage

Storage TypeUsed For
Blob StorageImages, Videos, PDFs, Documents
File StorageShared folders (SMB/NFS)
Queue StorageAsynchronous messaging
Table StorageNoSQL key-value data
Disk StorageAzure Virtual Machines

5. Blob Storage

Blob Storage is used for unstructured data.

Examples:

  • Product Images

  • Employee Photos

  • Invoice PDFs

  • Videos

  • Audio Files

  • Backup Files

Example architecture:

Customer Uploads Image

↓

ASP.NET Core API

↓

Blob Container

↓

Image URL stored in SQL Database

Instead of saving the image inside SQL Server, save only its URL.


6. Blob Types

Block Blob

Used for:

  • Images

  • Documents

  • PDFs

  • Videos

Most commonly used.

Append Blob

Optimized for:

  • Log files

Page Blob

Used by:

  • Azure Virtual Machine Disks


7. Container

A container is similar to a folder.

product-images

employee-documents

videos

backups

Example:

product-images

    laptop.jpg

    keyboard.jpg

    mouse.jpg

8. Blob Storage C# Example

Install package:

dotnet add package Azure.Storage.Blobs

Upload file:

using Azure.Storage.Blobs;

var client = new BlobServiceClient(connectionString);

var container =
    client.GetBlobContainerClient("product-images");

await container.CreateIfNotExistsAsync();

var blob =
    container.GetBlobClient("laptop.jpg");

await blob.UploadAsync(fileStream, overwrite: true);

Download:

var blob =
    container.GetBlobClient("laptop.jpg");

await blob.DownloadToAsync(stream);

9. Azure File Storage

Azure File Storage provides managed file shares.

Supports:

  • SMB

  • NFS (supported configurations)

Used for:

  • Shared documents

  • Lift-and-shift applications

  • Legacy applications

Example:

HR Department

↓

Azure File Share

↓

Payroll

Policies

Reports

10. Queue Storage

Queue Storage enables asynchronous communication.

Example:

Order API

↓

Queue Message

↓

Background Worker

↓

Email Sent

Useful for:

  • Email processing

  • Report generation

  • Image resizing


11. Queue Storage C# Example

using Azure.Storage.Queues;

var queue =
    new QueueClient(connectionString, "orders");

await queue.CreateIfNotExistsAsync();

await queue.SendMessageAsync("Order-1001");

Receive:

var messages =
    await queue.ReceiveMessagesAsync();

foreach (var message in messages.Value)
{
    Console.WriteLine(message.MessageText);

    await queue.DeleteMessageAsync(
        message.MessageId,
        message.PopReceipt);
}

12. Table Storage

Table Storage is a NoSQL key-value store.

Suitable for:

  • User preferences

  • Device telemetry

  • Session data

  • Lightweight metadata

Unlike SQL Server, there are no joins or foreign keys.


13. Storage Tiers

Hot

Frequently accessed data.

Example:

Product Images

Cool

Occasionally accessed.

Example:

Monthly Reports

Archive

Rarely accessed.

Example:

7-Year Audit Backups

Choosing the right tier can significantly reduce storage costs.


14. Redundancy Options

Azure Storage provides multiple redundancy options.

  • LRS (Locally Redundant Storage)

  • ZRS (Zone-Redundant Storage)

  • GRS (Geo-Redundant Storage)

  • GZRS (Geo-Zone-Redundant Storage)

Choose based on availability, durability, and disaster recovery requirements.


15. Security

Use:

  • Microsoft Entra ID authentication where possible

  • Managed Identity

  • Shared Access Signatures (SAS) for time-limited access

  • Private Endpoints

  • Encryption at Rest

  • HTTPS only

  • Customer-managed keys (when required)

Avoid exposing account keys directly in application code.


16. Real-Time E-Commerce Example

Customer Uploads Product Image
            |
            v
ASP.NET Core API
            |
            v
Azure Blob Storage
            |
            v
Store Blob URL
            |
            v
Azure SQL Database

When a customer opens the product page:

SQL returns Image URL

↓

Browser downloads image directly from Blob Storage

This reduces database size and improves scalability.


17. Monitoring

Monitor Azure Storage using:

  • Azure Monitor

  • Application Insights (application-side telemetry)

  • Storage metrics

  • Diagnostic logs

Track:

  • Capacity

  • Transactions

  • Latency

  • Availability

  • Failed Requests


18. Best Practices

  • Use Blob Storage for files instead of SQL Server.

  • Store only file metadata/URLs in the database.

  • Enable lifecycle management for old blobs.

  • Use SAS tokens for temporary client access.

  • Choose the correct redundancy option.

  • Select the appropriate storage tier.

  • Enable soft delete for recovery.

  • Use Managed Identity where supported.

  • Monitor costs and access patterns.


19. Lead-Level Interview Questions

Basic

  1. What is Azure Storage?

  2. What is a Storage Account?

  3. What are the different Azure Storage services?

  4. What is Blob Storage?

  5. What is Queue Storage?

Intermediate

  1. Difference between Blob, File, Queue, and Table Storage?

  2. What are Hot, Cool, and Archive tiers?

  3. Explain LRS vs GRS vs ZRS.

  4. What is a SAS token?

  5. How do you secure Azure Storage?

Lead-Level

  1. When would you use Blob Storage instead of Azure SQL Database?

  2. How would you design a scalable document management system?

  3. How would you secure file uploads?

  4. How would you reduce Azure Storage costs?

  5. How would you monitor Azure Storage in production?

  6. How would you implement disaster recovery?

  7. How would you integrate Azure Storage with Azure Functions?

  8. Explain lifecycle management policies.

  9. How would you design an image hosting platform using Azure Storage?

  10. What are the performance considerations for large file uploads?


20. Lead-Level Interview Answer

Interviewer: "How have you used Azure Storage in your project?"

Answer:

"In our .NET microservices application, we used Azure Blob Storage to store product images, invoices, and user-uploaded documents, while only storing the blob URLs in Azure SQL Database. Azure Queue Storage was used to decouple long-running processes such as email notifications and image resizing. Sensitive access was controlled using Shared Access Signatures (SAS) and Managed Identity where applicable. We configured lifecycle management to move older files from the Hot tier to the Cool and Archive tiers to optimize costs. Azure Monitor and Application Insights were used to monitor storage transactions, latency, and failures."

This is the type of answer expected from a .NET Lead, because it demonstrates not just knowledge of Azure Storage APIs, but also architecture, scalability, security, and operational best practices.

Azure Sql Database

 

Azure SQL Database — Complete Guide for .NET Lead

Azure SQL Database is one of the most important Azure services for .NET Developers, Technical Leads, and Solution Architects. It is a fully managed Database-as-a-Service (DBaaS) that provides SQL Server capabilities without requiring you to manage the underlying infrastructure.

In this guide, you'll learn:

  • What Azure SQL Database is

  • Architecture

  • Service tiers

  • Real-time enterprise example

  • Security

  • High Availability

  • Disaster Recovery

  • Scaling

  • Performance Optimization

  • Backup & Restore

  • Integration with .NET

  • Entity Framework Core example

  • Best Practices

  • Lead-level Interview Questions


1. What is Azure SQL Database?

Azure SQL Database is a fully managed relational database service built on the Microsoft SQL Server engine.

Unlike SQL Server installed on a Virtual Machine, Microsoft manages:

  • Hardware

  • Operating System

  • SQL Server Updates

  • Security Patches

  • Backups

  • High Availability

  • Failover

  • Monitoring

You only manage:

  • Database

  • Tables

  • Stored Procedures

  • Indexes

  • Security

  • Performance Optimization


2. Traditional SQL Server vs Azure SQL Database

Traditional SQL Server

Application
      |
      v
SQL Server
      |
Windows Server
      |
Virtual Machine
      |
Physical Hardware

You manage everything.


Azure SQL Database

Application
      |
      v
Azure SQL Database
      |
Microsoft Azure Platform

Microsoft manages the infrastructure.


3. Real-Time Example

Imagine an E-Commerce System.

Angular
    |
Azure App Service
    |
ASP.NET Core Web API
    |
Azure SQL Database

Tables:

Customers

Orders

Products

Payments

Invoices

Every customer request stores data in Azure SQL Database.


4. Real-Time Enterprise Architecture

                Users
                   |
            Azure Front Door
                   |
          Azure API Management
                   |
           Azure App Service
                   |
             ASP.NET Core API
                   |
        +----------+-----------+
        |                      |
 Azure SQL Database     Azure Service Bus
        |                      |
        |                Azure Functions
        |
Application Insights

5. Why Companies Choose Azure SQL Database

Benefits include:

  • Fully Managed

  • Automatic Backups

  • Built-in High Availability

  • Geo-Replication

  • Auto Scaling options

  • Advanced Security

  • Intelligent Performance

  • Monitoring

  • Integration with Azure services


6. Deployment Models

Single Database

Application

↓

Database

Suitable for independent applications.


Elastic Pool

Database A

Database B

Database C

↓

Shared Compute Resources

Ideal for SaaS applications with many small databases.


Managed Instance

Provides near full SQL Server compatibility for applications requiring SQL Server features not available in the single database model.


7. Service Tiers

  • Basic

  • Standard

  • Premium

  • General Purpose

  • Business Critical

  • Hyperscale

Choose based on performance, storage, and availability requirements.


8. High Availability

Azure SQL Database automatically maintains multiple replicas.

Application
      |
Primary Replica
      |
Secondary Replica

If the primary fails, Azure automatically fails over.


9. Disaster Recovery

Geo-Replication:

East US
   |
Primary Database
   |
Geo Replication
   |
West Europe
Secondary Database

Useful for regional outages.


10. Security Features

  • Microsoft Entra ID authentication

  • Transparent Data Encryption (TDE)

  • Always Encrypted

  • Dynamic Data Masking

  • Row-Level Security

  • Firewall Rules

  • Private Endpoint

  • Auditing

  • Defender for SQL


11. Connecting from ASP.NET Core

appsettings.json

{
  "ConnectionStrings": {
    "DefaultConnection":
      "Server=tcp:myserver.database.windows.net;
       Database=OrderDB;
       Authentication=Active Directory Default;"
  }
}

For production, prefer Managed Identity with Microsoft Entra ID instead of SQL usernames/passwords.


12. Entity Framework Core Example

public class Order
{
    public int Id { get; set; }

    public string CustomerName { get; set; }

    public decimal Amount { get; set; }
}

DbContext

public class AppDbContext : DbContext
{
    public AppDbContext(DbContextOptions<AppDbContext> options)
        : base(options)
    {
    }

    public DbSet<Order> Orders => Set<Order>();
}

Program.cs

builder.Services.AddDbContext<AppDbContext>(options =>
{
    options.UseSqlServer(
        builder.Configuration.GetConnectionString("DefaultConnection"));
});

13. Repository Example

public class OrderRepository
{
    private readonly AppDbContext _context;

    public OrderRepository(AppDbContext context)
    {
        _context = context;
    }

    public async Task<List<Order>> GetOrdersAsync()
    {
        return await _context.Orders.ToListAsync();
    }
}

14. Performance Optimization

Use:

  • Clustered Index

  • Non-Clustered Index

  • Query Optimization

  • Stored Procedures (where appropriate)

  • Pagination

  • Query Plan Analysis

  • Connection Pooling

  • Read replicas (when applicable)


15. Monitoring

Monitor with:

  • Azure Monitor

  • Application Insights

  • Query Performance Insight

  • Intelligent Insights

  • Query Store


16. Backup & Restore

Azure automatically performs backups.

Recovery options include:

  • Point-in-Time Restore

  • Long-Term Retention (LTR)

  • Geo-Restore


17. Scaling

Scale Up

Increase:

  • CPU

  • Memory

  • Storage

Scale Out

For read-heavy workloads, consider read replicas or application-level patterns where supported.


18. Real-Time Banking Example

ATM

↓

API

↓

Azure SQL Database

↓

Account

↓

Transactions

↓

Audit

Every transaction is stored safely with built-in durability.


19. Best Practices

  • Use Managed Identity

  • Enable TDE

  • Use Private Endpoints

  • Optimize indexes

  • Monitor slow queries

  • Enable automatic tuning where appropriate

  • Use parameterized queries

  • Implement retry logic for transient faults

  • Keep statistics updated


20. Frequently Asked Interview Questions

Basic

  1. What is Azure SQL Database?

  2. Difference between SQL Server and Azure SQL Database?

  3. What is DBaaS?

  4. What are Service Tiers?

  5. What is Elastic Pool?

Intermediate

  1. What is High Availability?

  2. Explain Geo-Replication.

  3. What is Point-in-Time Restore?

  4. What is TDE?

  5. What is Query Store?

  6. What is Automatic Tuning?

  7. How do you secure Azure SQL Database?

Lead-Level

  1. How would you design a highly available Azure SQL solution?

  2. How would you optimize a slow production database?

  3. Explain index fragmentation and maintenance.

  4. How would you troubleshoot blocking and deadlocks?

  5. How would you monitor Azure SQL in production?

  6. How would you migrate an on-premises SQL Server to Azure SQL Database?

  7. How do you design for multi-tenant SaaS using Elastic Pools?

  8. When would you choose Azure SQL Database vs Azure SQL Managed Instance?


21. Lead-Level Interview Answer

If asked:

"How have you used Azure SQL Database in your project?"

A strong answer is:

"In our microservices-based .NET application, Azure SQL Database was the primary transactional data store. We accessed it using Entity Framework Core with Repository and Unit of Work patterns. Authentication was implemented using Managed Identity, eliminating stored credentials. We enabled Transparent Data Encryption, automated backups, and geo-replication for disaster recovery. Query Store and Azure Monitor were used to identify slow-running queries, while indexing and query optimization improved performance. Azure DevOps pipelines managed database schema deployments alongside application releases, ensuring consistent and reliable deployments."

This answer demonstrates both implementation knowledge and production-level operational experience expected from a .NET Lead.

Don't Copy

Protected by Copyscape Online Plagiarism Checker