Depending on how a user configures AgentgatewayBackend, there is an explicit and implicit precedence for selecting the method of acquiring Azure credentials. This precedence flow documented in this issues was determined based on authentication with Azure AI Foundry and Azure OpenAI, but could apply to other use cases.
- Explicit auth config:
spec.policies.auth
auth.key/auth.secretRef: secret containing an API key
auth.azure.secretRef: references a user defined secret referencing an Azure service principle. Reads clientID, tenantID and clientSecret from the Secret
auth.azure.managedIdentity: specific user assigned identity (cliendID/objectID/resourceID)
- Implicit auth config: nothing set in
spec.policies.auth. Sources are tried in order (see build_credential() in azure.rs)
- EnvironmentCredential: service principle, if
AZURE_TENANT_ID, AZURE_CLIENT_ID, and AZURE_CLIENT_SECRET` are all set
- WorkloadIdentityCredential: Kubernetes workload identity, via
AZURE_FEDERATED_TOKEN_FILE, AZURE_TENANT_ID, and AZURE_CLIENT_ID
- ManagedIdentityCredential: Azure VM IMDS / App Service. User‑assigned selectable via
AZURE_CLIENT_ID. Guarded by a 1‑second TCP probe to 169.254.169.254:80; if IMDS is unreachable it's skipped to avoid the SDK's ~99 s retry loop (unless IDENTITY_ENDPOINT/MSI_ENDPOINT are set, which skips the probe)
- DeveloperToolsCredential:
az login / azd auth login, for local dev
Depending on how a user configures
AgentgatewayBackend, there is an explicit and implicit precedence for selecting the method of acquiring Azure credentials. This precedence flow documented in this issues was determined based on authentication with Azure AI Foundry and Azure OpenAI, but could apply to other use cases.spec.policies.authauth.key/auth.secretRef: secret containing an API keyauth.azure.secretRef: references a user defined secret referencing an Azure service principle. ReadsclientID,tenantIDandclientSecretfrom the Secretauth.azure.managedIdentity: specific user assigned identity (cliendID/objectID/resourceID)spec.policies.auth. Sources are tried in order (seebuild_credential()inazure.rs)AZURE_TENANT_ID,AZURE_CLIENT_ID, andAZURE_CLIENT_SECRET` are all setAZURE_FEDERATED_TOKEN_FILE,AZURE_TENANT_ID, andAZURE_CLIENT_IDAZURE_CLIENT_ID. Guarded by a 1‑second TCP probe to 169.254.169.254:80; if IMDS is unreachable it's skipped to avoid the SDK's ~99 s retry loop (unlessIDENTITY_ENDPOINT/MSI_ENDPOINTare set, which skips the probe)az login/azd auth login, for local dev