Overview
The Azure Storage components provide integration with Azure Storage services, including Blob Storage and Queue Storage. Each component registers the appropriate client type in your dependency injection container and automatically enables health checks, logging, and distributed tracing.Available components
Blob Storage
Store and manage unstructured data like images, documents, and backups
Queue Storage
Implement reliable messaging between application components
Blob Storage
TheAspire.Azure.Storage.Blobs component registers a BlobServiceClient for working with Azure Blob Storage.
Installation
Prerequisites
- Azure subscription - create one for free
- Azure Storage account - create a storage account
Usage
Register the component in your service’sProgram.cs:
Configuration
Service URI (recommended)
Provide a service URI in yourappsettings.json:
DefaultAzureCredential for authentication.
Connection string
Alternatively, use a connection string:Configuration providers
Inline configuration
Common scenarios
Upload with metadata
Generate SAS token
Copy blob
Queue Storage
TheAspire.Azure.Storage.Queues component registers a QueueServiceClient for working with Azure Queue Storage.
Installation
Usage
Register the component in your service’sProgram.cs:
Configuration
Service URI (recommended)
Connection string
Configuration providers
Inline configuration
Common scenarios
Process messages with visibility timeout
Send message with delay
Update message visibility
AppHost integration
In your AppHost project, install the Azure Storage hosting package:Best practices
Use managed identity in production
Use managed identity in production
Always use managed identity or DefaultAzureCredential in production instead of connection strings with account keys.
Implement retry policies
Implement retry policies
Configure retry policies for transient failures:
Use appropriate blob types
Use appropriate blob types
Choose the right blob type for your use case:
- Block blobs: General-purpose files (images, documents)
- Append blobs: Log files, audit trails
- Page blobs: Virtual hard disks (VHDs)
Implement proper error handling
Implement proper error handling
Handle storage exceptions appropriately:
Use queue poisoning detection
Use queue poisoning detection
Track dequeue count to detect poison messages:
Additional resources
Related components
Azure Cosmos DB
Connect to Azure Cosmos DB
Azure Service Bus
Work with Azure Service Bus
Redis
Add caching with Redis
Azure Storage Hosting
Learn about the Azure Storage hosting integration