The Simplest Way to Make Azure Service Bus and Azure Storage Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair azure service bus and azure storage to move big data files across apps. The queue sends fast alerts while the storage account holds the heavy file payloads. Message queues have strict size limits for each event they process. Large files can slow down the queue or cause message drops. Saving the file in storage first keeps your message traffic fast and light. The queue message only carries a small pointer to that stored file. How azure service bus and azure storage share data and ro

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Teams pair azure service bus and azure storage to move big data files across apps. The queue sends fast alerts while the storage account holds the heavy file payloads.

Message queues have strict size limits for each event they process. Large files can slow down the queue or cause message drops. Saving the file in storage first keeps your message traffic fast and light. The queue message only carries a small pointer to that stored file.

How azure service bus and azure storage share data and roles

This pattern is called the claim check pattern by cloud teams. A sending app writes a large file to a storage container first. Then the app sends a tiny message to the service bus queue. That message holds the exact file path and name for the stored data.

A worker app reads the small message from the queue next. The worker uses the file path to read the payload from storage. Once the worker finishes the job, it deletes the message and the file.

Both tools rely on cloud identities to check permissions and grant entry. You should use managed identities instead of static keys for your apps. A sending app needs a role to write blobs and send messages. A receiving app needs a role to read blobs and read messages. This separation stops one broken app from ruining the whole system.

Common failure modes and how to scope roles

Many teams make the mistake of sharing one master key across apps. If an attacker steals that shared key, they can read every file. Shared keys also make it hard to rotate secrets without breaking production apps. You cannot tell which user or app changed a file in the logs.

Broad permissions cause big problems when a bug hits your code. An app with admin rights might delete an entire storage container by mistake. Overly broad access tokens also let attackers move sideways across your cloud network. Unlogged reads and writes leave your security team blind during an audit.

Service-to-Service Authentication + Azure RBAC: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

You can fix this by giving each app its own identity. Scope the storage role down to one single container or folder path. Scope the queue role to one specific topic or queue name. Turn on network rules so only trusted virtual networks can reach both services.

Handling dead letters and orphan files in production

Sometimes a worker app fails to process a message after several tries. The queue moves that bad message into a dead letter subqueue. Still, the large file still sits in your storage account taking up space. If you ignore these orphan files, your storage bill will grow fast.

Set up a lifecycle rule on your storage container to clean up. This rule can delete files after a set number of days by default. You should also build a small worker to watch the dead letter queue. When a message fails, the team can inspect the payload and fix the bug.

Good logging links the queue message ID to the storage file name. Put the same tracking ID in your app logs and message headers. When an error happens, your team can trace the exact file in seconds. Masking rules can also rewrite emails or card numbers in those logs.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Why not put the whole file inside the queue message?

Queues work best with small text payloads and have strict size caps. Storing big files in blob storage keeps queue throughput high and costs low.

Never use public file links in your queue messages. Pass only the file name and require the worker to log in with its identity.

What happens if the storage write works but the queue send fails?

The file remains in storage without a matching queue message. A daily cleanup rule on the storage container can delete these untracked files.

The query runs. The emails stay hidden.