Skip to content
Tutorials Center
My learning

Topics

Lesson 16 of 57 ยท Storage

Azure Files, Queues and Tables

Learn Azure Files SMB and NFS shares, Queue Storage messages and the visibility timeout, Table storage keys, and when to choose each, with a queue simulator.

A storage account holds more than blobs. Besides Blob Storage it offers three other services that cover different needs: Azure Files for shared file systems, Queue Storage for simple message queues, and Table Storage for cheap key-value style data. They are easy to confuse because they live in the same account, share the same keys and security options, and look like "storage" in the portal. Each solves a different problem.

This lesson explains what each one does, how its main concept works (especially the queue's visibility timeout), and when you should pick something else. The real services need an account, so their commands and code are read-only. The runnable part is a Node.js stand-in for a queue that shows exactly how messages become invisible, reappear and get counted.

Azure Files

Azure Files gives you fully managed file shares in the cloud. You mount a share on a computer and use it like a network drive, with folders, file names, permissions and locking. Two protocols are available:

  • SMB (Server Message Block), the protocol Windows file servers use. It also works from Linux and macOS clients. Shares can integrate with Active Directory or Microsoft Entra Domain Services for identity-based access.
  • NFS (Network File System), the common Linux protocol. NFS shares need Premium (solid-state) file storage and are accessed from inside a virtual network.

Typical uses are replacing an on-premises file server, sharing configuration or content between several virtual machines, and giving containers a persistent folder. A share has a quota (the maximum size you set) and a performance tier: premium (SSD) or standard (hard disks, with transaction-optimized, hot and cool variants).

Terminal
# Read-only: needs a subscription
az storage share-rm create \
  --resource-group rg-data \
  --storage-account mydata12345 \
  --name teamfiles \
  --quota 100

# On a Linux VM, mounting over SMB (the account key goes in a credentials file, not in the command)
sudo mkdir -p /mnt/teamfiles
sudo mount -t cifs //mydata12345.file.core.windows.net/teamfiles /mnt/teamfiles \
  -o credentials=/etc/smbcredentials/mydata12345.cred,dir_mode=0777,file_mode=0777,serverino

Many networks block outbound port 445, which SMB uses, so mounting from a home or office network can fail until you use a VPN or a private connection (see Private Endpoints, VPN and ExpressRoute). Azure File Sync can keep a Windows file server cache in step with a share when you still need local speed.

Files is not the right choice for storing millions of web images or backups to serve over HTTP. That is Blob Storage's job, and it is cheaper.

Queue Storage

A queue decouples the code that produces work from the code that does it. A web request adds a message such as "resize image 42", returns to the user immediately, and a worker processes the message later. If the worker is slow or down, messages wait. If traffic spikes, the queue grows instead of the website falling over.

Queue Storage is the simplest queue in Azure. A message is up to 64 KB of text, and a queue can hold a very large number of messages (limited by the account's total capacity). Messages live up to 7 days by default; you can set a different time to live, including "never expires".

The key operations are:

  1. Put (enqueue) a message.
  2. Get a message. The service returns it and makes it invisible to other consumers for a visibility timeout (30 seconds by default).
  3. Delete the message once the work succeeded, using the pop receipt that came with it.

If the worker crashes before deleting, the timeout runs out and the message becomes visible again, so another worker gets it. This gives at-least-once delivery: a message is processed one or more times, never silently lost, but the same message can be delivered twice. Workers must therefore be idempotent, meaning that doing the same job twice has the same result as doing it once.

sequenceDiagram
    participant P as "Producer"
    participant Q as "Queue"
    participant W as "Worker"
    P->>Q: "Put message"
    W->>Q: "Get message"
    Q-->>W: "Message + pop receipt<br/>(invisible for 30 s)"
    W->>W: "Process the work"
    alt "Success"
        W->>Q: "Delete (pop receipt)"
    else "Worker crashes"
        Note over Q: "Timeout ends, message visible again"
    end

The visibility timeout is a lease. Delete before it ends, or the message comes back.

Each message carries a dequeue count. A message that keeps failing would loop forever, so good workers check the count and move the message to a "poison" queue after a few attempts (the Functions queue trigger does this for you automatically). Queue Storage has no topics, no ordering guarantee and no built-in dead-letter queue. If you need those, look at Service Bus Queues and Topics.

The SDK shape in JavaScript (read-only, needs an account and @azure/storage-queue):

JavaScript
import { QueueServiceClient } from "@azure/storage-queue";
import { DefaultAzureCredential } from "@azure/identity";

const service = new QueueServiceClient(
  "https://mydata12345.queue.core.windows.net",
  new DefaultAzureCredential()
);
const queue = service.getQueueClient("resize-jobs");
await queue.createIfNotExists();

await queue.sendMessage(JSON.stringify({ blob: "photos/cat.jpg" }));

const { receivedMessageItems } = await queue.receiveMessages({
  numberOfMessages: 1,
  visibilityTimeout: 60,
});
for (const msg of receivedMessageItems) {
  // ...do the work, then:
  await queue.deleteMessage(msg.messageId, msg.popReceipt);
}

A queue with a visibility timeout

The program below is a stand-in for the behaviour, not the Azure service. It uses a fake clock so the output is the same every run. Two workers take messages: one finishes its work, and one "crashes" before deleting. Watch the crashed message return and its dequeue count rise.

Node.js Queue with a visibility timeout

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.

The late delete shows why the pop receipt exists: when the lease has expired and someone else holds the message, the old receipt no longer works, so a slow worker cannot delete another worker's message. (In the real service, a stale receipt is rejected in a similar way. A worker that expects slow jobs should either set a longer visibility timeout when it gets the message or extend the lease with an update call.)

Table Storage

Table Storage stores entities (rows) made of properties (columns) in a table with no fixed schema. Every entity has two keys:

  • PartitionKey: groups related entities. Entities with the same partition key are stored together, and queries inside one partition are fast.
  • RowKey: identifies an entity uniquely inside its partition.

Together they form the primary key. The best design makes your common query a point lookup (PartitionKey and RowKey both known) or a range scan within one partition. Queries that scan across partitions are slow and are discouraged.

For example, an orders table could use the customer ID as PartitionKey and the order date plus number as RowKey, so "all orders of customer 42 in March" is a cheap range query in one partition.

JSON
{
  "PartitionKey": "customer-42",
  "RowKey": "2025-03-14_000187",
  "Total": 59.9,
  "Status": "shipped"
}

Table Storage is very cheap and scales well for simple lookups, but it has no joins, no secondary indexes and limited querying. Azure Cosmos DB offers a Table API with the same programming model plus global distribution and indexing; see Azure Cosmos DB. Many teams start with Table Storage for logs, device registries or settings, and move to Cosmos DB or a SQL database when queries get richer.

Here is a small stand-in for the key design idea. It stores entities in an in-memory map by partition and shows why a point lookup and a partition range query are cheap while a cross-partition filter must look at everything.

JS Partition and row keys

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The stand-in counts entities it touched. A real Table Storage service uses its own index on the two keys, so the point lookup is one read regardless of table size, while a filter on a non-key property forces a table scan.

Which service when?

Need Use
Shared drive that behaves like a network folder (SMB/NFS) Azure Files
Images, backups, logs, any file served over HTTPS Blob Storage
Simple background-work queue, small messages, at-least-once Queue Storage
Queue with topics, ordering sessions, dead-lettering, transactions Service Bus
Cheap key-value or entity lookups by partition and row Table Storage
Rich queries, indexes, global distribution Cosmos DB or a SQL database

Whichever you choose, lock down access carefully. The next lesson shows how: Storage Security and SAS Tokens.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. What happens when a Queue Storage message is received but the worker never deletes it?

    Receiving hides the message for the visibility timeout. If it is not deleted by then, it reappears with a higher dequeue count.
  2. 2. What does at-least-once delivery mean for your worker code?

    Because crashed or slow workers cause redeliveries, the same message can be processed twice. Idempotent workers make that harmless.
  3. 3. Which service would you use for a shared network drive mounted by several VMs over SMB?

    Azure Files provides managed file shares with SMB or NFS access. Blobs are accessed over HTTP, not mounted as a normal drive.
  4. 4. In Table Storage, what do PartitionKey and RowKey together form?

    The pair uniquely identifies an entity. Point lookups and partition range queries on these keys are the fast paths.
  5. 5. A project needs topics, subscriptions and a dead-letter queue. Which should you pick?

    Queue Storage is deliberately simple. Service Bus adds topics, sessions, dead-lettering and more.

Summary

  • Azure Files gives managed SMB or NFS file shares; Blob Storage is better for files served over HTTP.
  • Queue Storage holds messages up to 64 KB; a received message is hidden for the visibility timeout and must be deleted with its pop receipt.
  • Delivery is at-least-once, so workers must be idempotent and should handle poison messages using the dequeue count.
  • Table Storage is a schemaless key-value style store; PartitionKey plus RowKey form the primary key, and good designs use them in every query.
  • Pick Service Bus or Cosmos DB when you outgrow the simple services.

Next: Storage Security and SAS Tokens.