< Previous Challenge — Home — Next Challenge >
With eShopOnWeb running on .NET 10, the next step is to make it truly cloud-native: add Azure-managed services for the pieces that currently rely on local infrastructure, containerize both applications, and deploy them to Azure Container Apps.
Two cloud-modernization gaps need to be filled before deployment:
- Product images: currently embedded in the project. These need to move to Azure Blob Storage so the stateless container can serve them via SAS URLs.
- Order events: checkout currently creates orders synchronously with no downstream notification. Add an Azure Service Bus message published on every successful order so downstream services can subscribe asynchronously.
The Student/Resources/net8/infra/ directory contains a skeleton Terraform configuration. Your task is to complete it and deploy.
- Add the
Azure.Storage.BlobsNuGet package toInfrastructure - Create an
IBlobStorageServiceinterface inApplicationCoreand implement it inInfrastructureusingBlobContainerClient - Upload seed product images to the blob container during database seeding
- Update the product catalog views to generate SAS URLs via
BlobClient.GenerateSasUri() - Store the connection string / account URL in
appsettings.json(will move to Key Vault in Challenge 05)
- Add the
Azure.Messaging.ServiceBusNuGet package toInfrastructure - Create an
IOrderEventServiceinterface inApplicationCore - Implement
OrderEventServiceinInfrastructureusingServiceBusClientandServiceBusSender - Publish an
OrderPlacedEventmessage (JSON:orderId,buyerEmail,totalAmount,placedAt) fromPlaceOrderServiceafter a successful order - The Service Bus call must be fire-and-forget — a failure must not block the checkout
Update the Dockerfiles for both Web and PublicApi to use the .NET 10 base images. Verify that both multi-stage builds complete successfully.
Complete the Terraform skeleton in Student/Resources/net8/infra/ to provision:
- Azure Container Registry
- Azure Container Apps environment + two apps (
web,publicapi) - Azure SQL Database (Catalog + Identity databases)
- Azure Blob Storage account + container (
product-images) - Azure Service Bus namespace + queue (
orders)
Build and push both container images to the registry, then apply the Terraform configuration to provision the infrastructure.
To complete this challenge successfully, demonstrate:
- Both container images build successfully and are pushed to the registry
- The Terraform configuration applies without errors and all resources are provisioned
- The eShopOnWeb store is accessible at its Azure Container Apps URL — product images load from Azure Blob Storage
- The PublicApi OpenAPI (Scalar) endpoint is accessible from its Container App URL
- Placing an order results in a message appearing on the
ordersService Bus queue (visible in Azure Portal → Service Bus → queues → messages) - The deployed application can successfully read and write to Azure SQL, Service Bus, and Blob Storage
- Explain to your coach — why must the
ServiceBusClientbe registered as a singleton andServiceBusSenderbe reused rather than created per-request? What resource does each allocation consume?
- Azure Container Apps overview
- Azure Blob Storage SDK for .NET
- Azure Service Bus SDK for .NET
- Generate SAS tokens with BlobClient
- Deploy to Azure Container Apps with Terraform
- Dockerfile best practices for .NET
- The eShopOnWeb Dockerfile copies multiple project folders — ensure
COPYpaths are relative to the build context (solution root, notsrc/). - After applying your Terraform configuration, check the outputs to retrieve the Container App URLs.
- Connection strings must be passed as env vars or secrets in Container App config — never baked into the image.
- Service Bus fire-and-forget: wrap
SendMessageAsyncintry/catchand log without re-throwing. The order must always succeed.