Queue Storage¶
This guide explains how to enable and integrate Azure Storage queues with API services using the Forge platform.
Experimental Feature
Queue Storage support is experimental and newly added to the Forge platform. Behavior, defaults, and documentation may change without notice â validate carefully in a non-production environment before relying on it, and report issues you find.
đ¯ Overview¶
Azure Storage queues provide simple, high-throughput, low-cost message queuing on the same storage account used by Blob Storage. The Forge platform provides:
- Terraform Module: Automated Azure Storage queue provisioning, scoped to a single app's storage account
- RBAC Authentication: Secure, token-based access via the app's Entra identity (no keys or SAS tokens)
- Feature Flag: Independent enable/disable configuration, separate from blob/file
đ§ Infrastructure Setup (Terraform)¶
Prerequisites¶
enable_storage_queue and storage_queue_settings are members of the feature_flags object,
which uses optional(...) attributes and therefore requires Terraform >= 1.3.0 â the same floor
this change raises saif-api-service to. See the
Terraform version compatibility table if you're on an
older Terraform version.
Enable Queue Storage Feature Flag¶
Storage queue is a feature flag on the saif-apiservice module, so it is configured in the module
call that the templates generate for you â infra/api/app.generated.tf.
Add a feature_flags block to the existing module "saif-appservices" call:
feature_flags = {
enable_storage_queue = true
storage_queue_settings = {
queues = ["document-intake"]
contributor_group_id = "group-object-id-guid"
}
}
â ī¸
enable_storage_queueandstorage_queue_settingsare members of thefeature_flagsobject â they are not top-level module arguments. If the module call already has afeature_flagsblock (for example from Cosmos DB or Blob Storage), add these members to the existing object instead of adding a secondfeature_flags = { ... }block â Terraform rejects a duplicate.
Configuration Options:
| Property | Type | Description |
|---|---|---|
enable_storage_queue |
bool | Enable/disable storage queue provisioning |
storage_queue_settings.queues |
list(string) | Queue names to create |
storage_queue_settings.contributor_group_id |
string | Entra ID group object ID granted Storage Queue Data Contributor ("" = app identity only) |
Queue names: this module validates each name in storage_queue_settings.queues at plan time. Names must be 3 to 63 characters long, use only lowercase letters (a-z), digits (0-9), and hyphens, start and end with a letter or digit, and not contain consecutive hyphens. Each name must also be unique within the list. Terraform fails the plan on a violation instead of letting Azure reject the queue at apply time; see Naming queues and metadata.
â ī¸ Hardcode the object ID â don't resolve it with a
datasource. Terraform plans that look up the group at plan time fail the Organization Policy Check. Look up your team's Entra ID group object ID once (Entra admin center oraz ad group show --group "<display name>" --query id -o tsv) and paste the literal GUID intostorage_queue_settings. This matches the pattern used byblob_storage_settings.contributor_group_idâ see Blob Storage.
Generated Resources¶
When enable_storage_queue = true, the following resources are automatically created:
- đŦ Storage Queues â one
azurerm_storage_queueper name inqueues, on the app's storage account (shared with blob/file if those are also enabled) - đ RBAC â Storage Queue Data Contributor assigned to the application's Entra app registration
service principal (the runtime data-plane identity) and to the group in
storage_queue_settings.contributor_group_id - âī¸ App Setting:
ConnectionStrings__storagequeueis added to the web app with the primary queue endpoint of the storage account - đ Private Endpoint â queue sub-resource in the services subnet, registered in the
privatelink.queue.core.windows.netDNS zone
App Configuration can shadow this app setting
AddAzureDefaults() registers the Azure App Configuration provider after the App Service environment-variable provider, and the last provider registered wins, so a ConnectionStrings:storagequeue key published centrally to App Configuration silently overrides the ConnectionStrings__storagequeue app setting emitted here. See Feature Flags for the full ordering rules.
Network isolation follows the same deny-by-default firewall + private endpoint model as blob storage â see Network Isolation; the same corporate/colocation IP allowances and VPN caveat apply here.
Outputs¶
The module exposes storage_queue_names, a list of strings with the names of the queues it created (from storage_queue_settings.queues). The value is null when feature_flags.enable_storage_queue is false, so guard against null in consumers. For example, from the project's root Terraform:
output "queue_names" {
value = module.saif-appservices.storage_queue_names
}
locals {
queue_names = coalesce(module.saif-appservices.storage_queue_names, [])
}
See Blob Storage for the related file share output.
đ° Cost, Quota, and Operational Trade-offs¶
- Cost: Storage queue operations are billed per-transaction on the storage account, typically far cheaper than Service Bus at low-to-moderate volume, since there's no separate namespace tier to pay for.
- Quota: a single storage queue is capped at 500 TiB, within the storage account's overall 5 PiB default capacity limit; each message is capped at 64 KB.
- No native dead-lettering: the app is responsible for poison-message handling â track a message's dequeue count and move it to an app-defined "poison" queue after a threshold.
- When Service Bus is worth the extra ops cost: ordering guarantees, sessions, transactional sends, built-in dead-lettering, or messages larger than 64 KB. See Service Bus queue for that option and a side-by-side comparison.
đĨī¸ Using the SDK¶
Storage queue access uses the Aspire Azure Queue Storage client integration
(Aspire.Azure.Storage.Queues),
the same approach as Blob Storage. No
connection strings, no shared keys. The generated app setting is an endpoint URL, not a full
connection string, and the integration accepts a service URI under ConnectionStrings:<name>.
// Program.cs â the name must match the ConnectionStrings__storagequeue app setting
builder.AddAzureQueueServiceClient("storagequeue");
â ī¸ The connection name passed to
AddAzureQueueServiceClientmust match theConnectionStrings__{name}app setting Forge creates in Azure (storagequeue), and the name given toAddQueuesin the AppHost for local development. Otherwise the client cannot resolve the endpoint at startup.
using System.Text.Json;
using Azure.Storage.Queues;
app.MapPost("/api/intake", async (IntakeRequest request, QueueServiceClient queueServiceClient) =>
{
var queueClient = queueServiceClient.GetQueueClient("document-intake");
await queueClient.CreateIfNotExistsAsync();
await queueClient.SendMessageAsync(JsonSerializer.Serialize(request));
return Results.Accepted();
});
âšī¸
AddAzureQueueServiceClientusesDefaultAzureCredentialwhen the setting is a service URI. In Azure, the platform pins the credential chain to the app registration service principal (AZURE_TOKEN_CREDENTIALS=environmentcredential), which holds the Storage Queue Data Contributor role granted above â the same pattern used by blob storage.
đ Related Resources¶
- Blob Storage
- Service Bus queue
- File Share Storage
- Aspire Azure Queue Storage: get started (AppHost)
- Aspire Azure Queue Storage: client integration
- Azure Storage Queues Documentation
â FAQ¶
Q: How do I add more queues after initial deployment?
A: Update the queues list in storage_queue_settings and reapply Terraform.
Q: Does Storage queue support dead-lettering like Service Bus?
A: No â Storage queues have no native dead-letter queue. Track a message's dequeue count and move it to an app-defined "poison" queue after a threshold, or use a Service Bus queue if you need built-in dead-lettering.
Q: Can I enable queue alongside blob and file?
A: Yes â blob, queue, and file are independent feature flags and share the same storage account when enabled together on the same app. Table storage is not currently supported.