Skip to content

The Store on Azure: Target Architecture

In this chapter, we take a closer look at the system this book runs and the platform we'll build for it. You'll see why Kubernetes is the go-to platform for running microservices, which Azure services the store needs and why, and how the pieces fit together. Every later chapter builds one part of this picture.

Introduction

Modern application development with microservices

Today’s software systems are increasingly built using microservices architecture, where applications are broken down into smaller, loosely coupled services. Each service is independently developed, deployed, and maintained—enabling faster release cycles, team autonomy, and better scalability.

However, this approach also introduces new challenges. Managing many services, coordinating deployments, monitoring health, and scaling them efficiently requires more than traditional infrastructure tools can offer.

The Store We Run

The system in this book is the online store from my companion book, Building Microservices with Containers, where its design is worked out in The Store We Will Build. Customers browse products on a React storefront and place orders; staff manage products on an ASP.NET Core admin site. Behind them, a .NET Product API owns the catalog in SQL Server, a Node.js Order API owns orders in PostgreSQL, a notification worker reacts to every OrderPlaced event from a message broker, and Keycloak signs users in. In the companion book the store runs on one machine with Docker Compose; here it runs on Azure, from the same container images.

Why Kubernetes?

Kubernetes—often abbreviated as K8s—is the industry standard for container orchestration. It automates the deployment, scaling, and management of containerized applications, making it an ideal platform for running microservices at scale.

In this book, we use Azure Kubernetes Service (AKS), Microsoft’s managed Kubernetes offering. AKS provides all the capabilities of Kubernetes without the overhead of managing the control plane, making it easier to get started and focus on running applications.

Kubernetes brings several powerful features that are particularly well-suited to microservices environments:

  • Self-healing: Automatically restarts failed containers and reschedules them as needed.
  • Auto-scaling: Dynamically adjusts the number of running instances based on resource usage or demand.
  • Rolling updates and rollbacks: Ensures smooth deployment with minimal downtime.
  • Service discovery and load balancing: Manages internal communication between services efficiently.
  • Declarative configuration: Infrastructure and application deployments are defined in code, supporting version control and repeatability.

High Level Architecture

The following diagram shows the target architecture: the store running on AKS, and the Azure services around it.

flowchart LR
  user([Browser]) -->|https store.example.com| gw
  user -->|https auth.example.com| gw
  subgraph AKS["AKS cluster aks-store-dev (spoke network)"]
    gw[Gateway API<br/>application routing] --> sf[storefront]
    gw --> adm[admin]
    gw -->|/api/products| prod[product-api]
    gw -->|/api/orders| ord[order-api]
    gw --> kc[keycloak]
    ord --> prod
    ord -->|OrderPlaced| mq[(RabbitMQ cluster)]
    mq --> nw[notification-worker]
    otel[OpenTelemetry Collector]
  end
  prod -->|private endpoint, passwordless| sql[(Azure SQL<br/>product-db)]
  ord -->|private endpoint| pg[(PostgreSQL Flexible Server<br/>order-db, keycloak-db)]
  kc --> pg
  AKS -->|CSI driver + workload identity| kv[Key Vault]
  AKS -->|AcrPull| acr[Container Registry]
  otel --> appi[Application Insights]
  AKS --> mon[Container Insights<br/>managed Prometheus<br/>Grafana]

Platform Components

Below, we walk through each component in the order the book builds it: what it's for, how the store uses it, and the chapter that builds it.

Azure Log Analytics Workspace

Purpose: Centralized logging and telemetry collection.

Role in the store: Observability is crucial in distributed systems. Every Azure resource sends its diagnostic logs here, and later the cluster sends its container logs. It's built first so everything after it can report to it. Built in Create Log Analytics Workspace using terraform.

Azure Virtual Network (hub and spoke)

Purpose: Secure, isolated network space in Azure.

Role in the store: A hub network holds shared services, and a peered spoke network holds the cluster and the private endpoints of every data service. Private DNS zones make those private endpoints resolve from inside the network, so the databases, Key Vault and registry are never exposed to the internet. Built in Create Virtual Network using terraform.

Azure Container Registry (ACR)

Purpose: Private registry to store and manage container images.

Role in the store: The store's images are built here from the companion book's source code, and the cluster pulls them through a private endpoint with its own identity, without any registry password. Built in Create Azure Container Registry (ACR) using terraform.

Azure Kubernetes Service (AKS)

Purpose: Managed Kubernetes platform on Azure.

Role in the store: AKS is the heart of the platform: it runs every service of the store, scales them, and replaces them when they fail. The cluster uses Microsoft Entra ID sign-in, separates system pods from the store's pods in two node pools, and spreads nodes across availability zones. Built in Create Azure Kubernetes Service (AKS) using terraform and Create a new user node pool in AKS.

Azure Key Vault

Purpose: Securely store and manage secrets, certificates, and encryption keys.

Role in the store: Terraform generates every password the store needs and stores it here, so nobody types one. Each service reads only its own secrets, using its own workload identity. Built in Create Azure Key Vault using Terraform; the services read it as shown in Integrating Azure Key Vault with AKS using Terraform.

Azure Database for PostgreSQL Flexible Server

Purpose: Managed PostgreSQL database service with high availability and backups.

Role in the store: One server holds two databases: the Order API's orders and Keycloak's data. It replaces the PostgreSQL containers from the companion book and is reachable only through its private endpoint. Built in Create Azure PostgreSQL - Flexible Server using terraform.

Azure SQL Database

Purpose: Managed SQL Server database service.

Role in the store: Holds the Product API's catalog, replacing the SQL Server container. The Product API signs in with its workload identity, so there is no database password at all. Built in a new chapter, "Azure SQL Database".

Gateway API routing

Purpose: Route traffic from the internet to the right service.

Role in the store: The AKS application routing add-on implements the Kubernetes Gateway API. Its routes replace the companion book's nginx gateway one for one: / to the storefront, /admin to the admin site, /api/products and /api/orders to the APIs, and a second hostname for Keycloak. Built in a new chapter, "Ingress with Gateway API".

cert-manager and Azure DNS

Purpose: Domain names and automatic TLS certificates.

Role in the store: An Azure DNS zone holds the store's hostnames, and cert-manager requests and renews Let's Encrypt certificates for them. Built in Setup Cert-Manager in AKS using Terraform.

RabbitMQ and Keycloak on AKS

Purpose: The store's message broker and identity server.

Role in the store: Both run inside the cluster, managed by their Kubernetes operators, so the store's code doesn't change. RabbitMQ keeps its messages on persistent disks; Keycloak keeps its data in PostgreSQL. Built in a new chapter, "Stateful services: RabbitMQ and Keycloak".

Monitoring: Azure Monitor, Grafana and Application Insights

Purpose: See what the platform and the store are doing.

Role in the store: Container Insights and managed Prometheus collect the cluster's logs and metrics, Managed Grafana shows them on dashboards, and an OpenTelemetry Collector forwards the store's traces to Application Insights, so one order can be followed across services. Introduced in Monitor AKS Cluster Introduction.

Pipelines and GitOps

Purpose: Deploy every change from Git.

Role in the store: Azure DevOps pipelines run Terraform and build images, and Argo CD keeps the cluster in sync with the repository. Built in a new part, "Automate".

Optional Services

Some Azure services are common in microservices platforms but the store doesn't need them. The book covers them in an optional part:

  • Azure Managed Redis: a shared cache for frequent reads and sessions. The store's data is small enough not to need one.
  • Azure Storage: blobs and file shares for uploads, images and backups. The store keeps no files.
  • Azure Event Hubs: high-throughput event streaming with a Kafka endpoint. The store's events are few, so RabbitMQ fits better.
  • Azure Front Door: a global entry point with caching and a Web Application Firewall. Worth adding in front of the Gateway when the store serves users around the world.

How This Compares to Microsoft's AKS Baseline

Microsoft publishes a baseline architecture for an AKS cluster. The book follows it closely and simplifies a few things to keep the labs affordable:

Area AKS baseline This book
Network Hub-spoke with peering Same
Ingress Gateway API through the application routing add-on Same
Identity Workload identity, Entra ID sign-in, local accounts disabled Same
Secrets Key Vault with the CSI driver Same
Monitoring Container Insights, managed Prometheus, Grafana Same
Egress All outbound traffic through Azure Firewall Standard load balancer outbound; Azure Firewall described as a production option
Cluster API access Restricted access Public endpoint limited to your IP address; private cluster in an optional chapter
Control plane tier Standard (uptime SLA) Free in dev, Standard in prod

Azure + Terraform = Production-Ready IaC

Microsoft Azure provides comprehensive support for containerized workloads, cloud-native development, and scalable microservices architecture. Its global presence, enterprise-grade security, and integration with identity (Microsoft Entra ID), monitoring, and DevOps pipelines make it an excellent platform for delivering modern, distributed applications at scale.

Terraform by HashiCorp provides a powerful, cloud-agnostic way to manage Azure infrastructure through code. Using the Azure Provider (azurerm), we define everything from virtual networks and Kubernetes clusters to databases and DNS zones in a repeatable, automated way.

By combining Terraform with Azure’s native services, you gain a scalable, version-controlled approach to building and managing modern microservices infrastructure.

Reference