Tokens and files19 / 30
Minimal Pod Specification
A Deployment opts in with a service account and pod-template label; the webhook adds the token projection at admission.
Learning status: Not practiced
The moving parts
The service account carries the client ID annotation. The pod template names that service account and opts into mutation with the required label.
apiVersion: v1
kind: ServiceAccount
metadata:
name: orders-reader
namespace: workloads
annotations:
azure.workload.identity/client-id: "<USER_ASSIGNED_IDENTITY_CLIENT_ID>"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: orders-api
namespace: workloads
spec:
replicas: 2
selector:
matchLabels:
app: orders-api
template:
metadata:
labels:
app: orders-api
azure.workload.identity/use: "true"
spec:
serviceAccountName: orders-reader
containers:
- name: app
image: example.azurecr.io/orders-api:1.0
The webhook injects the projected token volume and its environment variables; do not manually copy a token into a Kubernetes Secret. The FIC subject must exactly match system:serviceaccount:workloads:orders-reader.
Use a unique service account per trust boundary, least-privilege Azure permissions, and a non-root application container where feasible.
Source: Deploy an app with AKS Workload ID.
Connects to