fINTERACTIVE FIELD GUIDES
Tokens and files17 / 30

Token Files and Their Paths

The Workload ID token and Kubernetes API token are different projected files; discover the Azure token path from its environment variable.

Learning status: Not practiced

There can be more than one token file in a pod. Do not treat every file named token as interchangeable.

Common file pathWhat it is for
/var/run/secrets/azure/tokens/azure-identity-tokenCommon Workload ID webhook mount location for the Entra-exchange JWT; read the actual path from AZURE_FEDERATED_TOKEN_FILE
/var/run/secrets/kubernetes.io/serviceaccount/tokenKubernetes API authentication token, when the pod's service-account token is mounted

The Azure token path is an implementation detail of the webhook. Do not hard-code it in code, images, or pod manifests. Read AZURE_FEDERATED_TOKEN_FILE; Azure Identity SDKs and MSAL handle it automatically.

The webhook also injects identity configuration such as AZURE_CLIENT_ID and AZURE_TENANT_ID. Inspect the actual pod after admission when verifying a deployment:

kubectl exec -n <namespace> <pod> -- printenv AZURE_FEDERATED_TOKEN_FILE
kubectl exec -n <namespace> <pod> -- ls -l "$AZURE_FEDERATED_TOKEN_FILE"

Avoid printing token contents into terminals, logs, support tickets, or CI output.

Source: Locate the projected token file.