Skip to main content

Azure Blob Storage

RoundTrip uses Azure Blob Storage for storing generated invoice PDFs. The storage account is provisioned in the rg-roundtrip-production resource group and is accessed by the API via a connection string stored in Key Vault.


What Blob Storage Holds

ContainerContentsAccess
invoice-pdfsGenerated invoice PDFs, named {tenantId}/{invoiceId}.pdfPrivate — accessed via API only

Configuration

Key Vault Secret

Secret NameConfig KeyPurpose
ConnectionStrings--BlobStorageConnectionStrings:BlobStorageAzure Storage account connection string

App Service Setting

Setting NameValue
ConnectionStrings__BlobStorage@Microsoft.KeyVault(VaultName=kv-roundtrip-production;SecretName=ConnectionStrings--BlobStorage)

Invoice PDF Flow

1. Ticket completed → TicketCompletedEvent raised


2. Domain event handler → Hangfire.Enqueue<GenerateInvoicePdfJob>


3. GenerateInvoicePdfJob
│ Loads invoice from database
│ Generates PDF via QuestPDF
│ Uploads to blob: invoice-pdfs/{tenantId}/{invoiceId}.pdf


4. SendInvoiceEmailJob (runs separately)
│ Checks blob for invoice-pdfs/{tenantId}/{invoiceId}.pdf
│ If found → attaches PDF to email
│ If not yet available → sends email without attachment (logs warning)

Blob Naming Convention

Container: invoice-pdfs
Blob path: {tenantId}/{invoiceId}.pdf

Example:
ad05b136-e770-4650-b563-75b7dad17234/b5a1725b-f8b3-44a7-a54e-0d87bc9c3e4f.pdf
└─ tenantId └─ invoiceId

Storage Account

ItemDetail
Resource namestroundtripproduction
Resource grouprg-roundtrip-production
RegionCentral US
AccessVia connection string — Managed Identity access planned
LoginAzure Portal → Traxs Group Subscription → stroundtripproduction

Troubleshooting

"Blob not found in container invoice-pdfs"

This warning appears in logs when the invoice email job runs before the PDF generation job completes. It is not an error — the email is sent without the PDF attachment.

If the PDF never appears in blob storage:

  1. Check Hangfire dashboard for GenerateInvoicePdfJob failures
  2. Check App Service logs for QuestPDF rendering errors
  3. Verify ConnectionStrings__BlobStorage App Service setting resolves correctly (green Key Vault checkmark)
  4. Check that the invoice-pdfs container exists in the storage account

Viewing blobs in storage

Use Azure Storage Explorer or the Azure Portal:

  1. Azure Portal → stroundtripproduction → Containers → invoice-pdfs
  2. Navigate to {tenantId}/ folder to find invoices for a specific tenant

Planned Enhancements

EnhancementNotes
Switch to Managed Identity accessReplace connection string with Managed Identity for improved security posture
Signed URL for PDF downloadGenerate short-lived SAS URLs for direct PDF download links in the app
Attachment storageStore job site photos and ticket attachments uploaded by technicians