Azure Functions application for managing album covers with Azure Blob Storage integration.
This project was created using Azure Functions Core Tools:
func init --worker-runtime dotnet-isolated
func new --name CreateCover --template "Http trigger"
func new --name GetStorageInfo --template "Http trigger"The project follows Hexagonal Architecture (Ports and Adapters) with clean separation of concerns:
src/
├── application/
│ ├── dto/ # Data Transfer Objects
│ └── service/ # Application Services
├── domain/
│ ├── entity/ # Domain Entities
│ ├── exception/ # Domain Exceptions
│ └── ports/ # Interfaces (Ports)
├── function/ # Azure Functions (Adapters)
└── infraestructure/ # External Adapters (Azure Blob Storage)
- Domain: Core business logic and entities
- Application: Use cases and application services
- Infrastructure: External integrations (Azure Blob Storage)
- Function: HTTP endpoints and Azure Functions
- Endpoint:
GET /api/storage-info - Purpose: Generates Azure Blob Storage SAS (Shared Access Signature) tokens
- Use Case: Allows client applications to upload files directly to Azure Storage
- Response: Returns a pre-signed URL with upload permissions
- Endpoint:
POST /api/create-cover - Purpose: Creates a new album cover and uploads the image file
- Input: Form-data with
coverName(text) andfile(image) - Process:
- Uploads image to Azure Blob Storage
- Creates Cover entity with metadata
- Returns cover information with storage URL
Set the following environment variables in local.settings.json:
{
"Values": {
"AzureWebJobsStorage": "your_azure_storage_connection_string",
"BlobContainerName": "your_container_name"
}
}-
Install dependencies:
dotnet restore
-
Build the project:
dotnet build
-
Start the function app:
func start
GET http://localhost:7071/api/storage-infoResponse:
{
"storageUrl": "https://account.blob.core.windows.net/container?sv=2022-11-02&ss=b&srt=c&sp=cw&se=2025-11-10T18:51:55Z&st=2025-11-10T16:51:55Z&spr=https&sig=..."
}POST http://localhost:7071/api/create-cover
Content-Type: multipart/form-data
Form fields:
- coverName: "My Album Cover"
- file: [image file]Response:
{
"message": "Cover created and upload completed successfully!",
"cover": {
"id": "guid",
"fileName": "My Album Cover",
"storageUrl": "https://account.blob.core.windows.net/container/image.jpg"
}
}- .NET 8 - Runtime
- Azure Functions - Serverless compute
- Azure Blob Storage - File storage
- C# - Programming language
- Dependency Injection - IoC container
- Cover: Domain entity representing an album cover
- IStorageService: Port for storage operations
- AzureBlobStorageImpl: Azure Blob Storage adapter
- ICoverService: Port for cover management
- CoverServiceImpl: Cover business logic implementation
- SAS tokens are generated with limited permissions (Create, Write)
- Tokens have 2-hour expiration time
- File uploads are validated and processed securely