Chapter 6 · Shared services and governance
Shared Services: Network, Key Vault and State Storage
Why a shared resource group
The idea is to keep the resources and the network that several workloads use in one place, instead of each workload building its own.
The network is where this matters most. At work I see it often: there's a core network resource group with the VNets, but every project's resource group carves its own subnets out of the address space. A project creates a /26 for three or four resources, and the rest of those addresses sit unused. Repeat that across enough projects and the address space runs out long before it's actually full.
So here the subnets live in shared-infra, together with the things
other resource groups should reference rather than recreate: shared
secrets and state storage today, and things like a container registry or
an AKS cluster later. A workload points at what's already there.
What it is
shared-infra is the first workload on top of the
landing zone. It owns the pieces more than one
repo uses:
- two subnets in the core VNet,
shared-dataandshared-app, each with its own NSG; - the
shared-cc-01-kvKey Vault for shared secrets; - the
sharedccststorage account, which holds the Terraform state for every repo in the platform.
Like every workload, it runs through its own pipeline as its own service
principal, scoped to the shared-cc-rg resource group.
Private endpoints: built, proved, removed
The landing zone created private DNS zones for blob, web and Key Vault, and I put private endpoints on the vault and the state storage. They worked.
The problem was who needed to reach them. The pipeline agents run in Docker Desktop on my own machine, outside the VNet. They could only ever reach the vault and the storage account over the public endpoint, so public network access had to stay on anyway. A private endpoint that nothing uses is just a monthly cost, so I removed them.
Both resources are still locked down without them:
- network access is deny by default, with one allowed IP, the agent's;
- the storage account has access keys turned off, so Terraform's backend signs in with Entra ID;
- access is RBAC only, granted per service principal.
The DNS zones are still there, and the module inputs that wire the endpoints are commented out next to the settings that replaced them. What would bring them back is something that actually lives inside the network: agents running in Azure, or real hybrid connectivity.
Flow logs went the same way
VNet flow logs were built too, writing to a dedicated storage account.
They're switched off for cost. The config is
commented out and ready to turn back on, and sharedccst is now the only
storage account in the subscription.
Cost Management
Cost is watched once, at the subscription: a $50 monthly budget from the landing zone that alerts at 50%, 75% and 90% of actual spend. It covers every resource group, including this one, so there's no second budget here. More on this in the governance post.
Current state
Live and applied through its own pipeline. Every repo's state is in
sharedccst, the vault and the storage account are reachable only from
the agent's IP and only with RBAC, and the private endpoint setup can
come back with a few uncommented lines if the agents ever move into
Azure.