Skip to content

Prepare and apply on Azure

What you will end up with

An installation on AKS with workload identity bound end to end, and its nodes enrolled. Azure runs the same way as the other clouds.

Prerequisites

  • An organization with reconciled enrollment governance, and a pool.
  • An AKS cluster with the OIDC issuer and workload identity enabled, and kubectl pointed at it.
  • A container registry, a storage account and a container that already exist.
  • terraform on your path, and az login done.
export ORG=acme
export POOL=edge-eu
export DP_INSTALL=dp-eu-west1
export AZ_RG=<resource-group>
export AZ_LOCATION=<location>

1. Collect the values

az account show --query "{subscription_id:id, tenant_id:tenantId}" -o tsv
export AZ_SUB=$(az account show --query id -o tsv)
export AZ_TENANT=$(az account show --query tenantId -o tsv)
export AKS_ISSUER=$(az aks show -g ${AZ_RG} -n <cluster-name> \
  --query "oidcIssuerProfile.issuerUrl" -o tsv)
export ACR_SCOPE=$(az acr show -g ${AZ_RG} -n <acr-name> --query id -o tsv)

Confirm both cluster features are on:

az aks show -g ${AZ_RG} -n <cluster-name> \
  --query "{oidc:oidcIssuerProfile.enabled, wi:securityProfile.workloadIdentity.enabled}"

2. Prepare

xratu dataplane install prepare "${ORG}" "${POOL}" "${DP_INSTALL}" \
  --provider azure \
  --dp-count 2 \
  --artifact-registry <acr-name>.azurecr.io/<repository> \
  --artifact-bucket azblob://<storage-account>/<container>/<prefix> \
  --subscription-id ${AZ_SUB} \
  --tenant-id ${AZ_TENANT} \
  --location ${AZ_LOCATION} \
  --resource-group ${AZ_RG} \
  --aks-oidc-issuer ${AKS_ISSUER} \
  --artifact-registry-scope ${ACR_SCOPE}
{
  "status": "prepared",
  "dp_install": "dp-eu-west1",
  "dp_count": 2,
  "provider": "azure",
  "output_dir": "install/dp-eu-west1",
  "written_file_count": 9
}

3. Review the generated Terraform

grep '^resource' install/${DP_INSTALL}/terraform/main.tf

Two managed identities, two federated credentials and four role assignments, and nothing creating a registry or storage account.

Check the subject on each federated credential, which pins the identity to one Kubernetes service account:

grep -A6 "azurerm_federated_identity_credential" install/${DP_INSTALL}/terraform/main.tf
  subject             = "system:serviceaccount:dp-eu-west1:xratud"
cd install/${DP_INSTALL}/terraform && terraform init && terraform plan; cd -

4. Apply

xratu dataplane install apply "${ORG}" "${POOL}" "${DP_INSTALL}"

Apply runs Terraform, reads the client IDs from its outputs, substitutes them into the service account manifest, and applies the cluster layer. No editing is involved. See Azure workload identity.

5. Or run both in one call

xratu dataplane install up "${ORG}" "${POOL}" "${DP_INSTALL}" \
  --provider azure \
  --dp-count 2 \
  --artifact-registry <acr-name>.azurecr.io/<repository> \
  --artifact-bucket azblob://<storage-account>/<container>/<prefix> \
  --subscription-id ${AZ_SUB} \
  --tenant-id ${AZ_TENANT} \
  --location ${AZ_LOCATION} \
  --resource-group ${AZ_RG} \
  --aks-oidc-issuer ${AKS_ISSUER} \
  --artifact-registry-scope ${ACR_SCOPE}

6. Verify the bindings

kubectl -n ${DP_INSTALL} get serviceaccount xratud \
  -o jsonpath='{.metadata.annotations}'
az identity federated-credential list \
  -g ${AZ_RG} --identity-name ${DP_INSTALL}-runtime -o table
az role assignment list \
  --assignee $(az identity show -g ${AZ_RG} -n ${DP_INSTALL}-runtime --query principalId -o tsv) \
  --all -o table

Then the nodes:

kubectl -n ${DP_INSTALL} get pods
xratu get dataplanes

If it fails

Symptom Cause Fix
provider_config.artifact_registry_scope is required for azure Missing flag Step 1
Terraform fails on the federated credential The AKS OIDC issuer is wrong or the feature is off Step 1
Terraform fails on a role assignment The registry scope or the container does not exist Confirm with az acr show and az storage container show
refused to apply ... with unresolved terraform placeholders Terraform emitted no client-ID outputs Confirm terraform apply succeeded and terraform output -json lists them
Pods run but cannot reach the registry The client ID is wrong, or workload identity is off on the cluster Compare the annotation against az identity show
Pods never enrol The enrollment path, not Azure See Diagnosing a node that will not enroll

What changed

Object State
Azure Two managed identities, two federated credentials, four role assignments
Cluster Namespace, annotated service accounts, SPIRE, authority, fabric, StatefulSet
The bundle Unchanged; the client IDs are substituted in memory at apply
Control plane Scheduler capability recorded, nodes enrolled