Files
spring-ai/cloud-providers
..

cloud-providers

Keyless Spring AI on Amazon Bedrock (IAM role, IRSA, EKS Pod Identity) and Azure OpenAI (Microsoft Entra ID, managed identity): no API key and no secret key in the application, and an audit line for every model call.

No AWS account and no Azure subscription was used, and no real cloud endpoint was called. LocalCloud is one local HTTP server that stands in for AWS STS, Bedrock Runtime, the Azure managed identity token endpoint and an Azure OpenAI chat-completions endpoint. The real Spring AI classes (BedrockProxyChatModel, OpenAiChatModel), the real AWS SDK v2 credential provider chain and the real azure-identity library run in a child JVM with an exact environment (AWS_ROLE_ARN, AWS_WEB_IDENTITY_TOKEN_FILE, AWS_CONTAINER_CREDENTIALS_FULL_URI, IDENTITY_ENDPOINT, IDENTITY_HEADER) and talk to it, so what the stub records is what those libraries send. What is not verified: that a real STS, Entra ID, Bedrock or Azure OpenAI accepts those requests; IAM and Azure RBAC policies (deploy/ files are examples, never applied); model ids; EKS and AKS webhooks; CloudTrail and Azure Monitor contents; latency.

Spring Boot 4.2.0 (GA 2026-11-19)
Spring AI 2.1.0 (GA 2026-11-19)
AWS SDK for Java v2 2.55.14 (what Spring AI 2.1.0 resolves; Maven Central has 2.59.11)
azure-identity 1.19.0 (latest on Maven Central; Spring AI does not bring it, you add it)
Java 25 (Temurin 25.0.5.1)

Run it

export JAVA_HOME=/path/to/jdk-25
./scripts/run-all.sh        # runs the tests; they write every file under output/

Every figure in output/ is also an assertion in a test. Each scenario starts the application in its own JVM, so the full run takes several minutes.

To run the application by hand against your own account: SPRING_PROFILES_ACTIVE=bedrock (credentials come from whatever your environment provides) or azure / azure-default with AZURE_OPENAI_ENDPOINT and AZURE_OPENAI_DEPLOYMENT set.

Layout

Path What it is
src/main/.../AuditAdvisor.java One structured audit line per model call: provider, principal, model, outcome, tokens. No prompt, no secret
src/main/.../BedrockConfig.java Audit identity for Bedrock: STS GetCallerIdentity through the same credentials provider. No credential code
src/main/.../BedrockRegionFromEnvConfig.java A one-bean fix so Bedrock honours AWS_REGION (profile bedrock-region-env)
src/main/.../AzureConfig.java Explicit ManagedIdentityCredential and an OpenAiChatModel built on it (profile azure)
src/main/.../AzureDefaultConfig.java Properties-only Azure: Spring AI builds DefaultAzureCredential (profile azure-default)
src/main/resources/application-*.properties The whole configuration per profile
src/test/.../support/LocalCloud.java The local stand-in for STS, Bedrock, the Azure identity endpoint and Azure OpenAI
src/test/.../support/AppProcess.java Runs the real application in a child JVM with an exact environment
deploy/ Example IAM policies, IRSA and Pod Identity manifests, Azure CLI steps. Never applied
scripts/azure-starter-check.sh Shows that the dedicated Azure OpenAI starter is not in the Spring AI 2.1.0 BOM

Captured output

File Test What it shows
00-azure-starter.txt scripts/azure-starter-check.sh spring-ai-starter-model-azure-openai stops at 2.0.0-M4 and is not in the 2.1.0 BOM
01-bedrock-irsa.txt BedrockTest IRSA environment in, SigV4 request signed with temporary STS credentials out
02-bedrock-region-trap.txt BedrockTest AWS_REGION is ignored by Spring AI's Bedrock auto-configuration, and a one-bean fix
03-bedrock-precedence.txt BedrockTest A leftover AWS_ACCESS_KEY_ID or spring.ai.bedrock.aws.access-key beats the role
04-bedrock-no-credentials.txt BedrockTest The full chain error, and a failed call that is still audited
05-bedrock-credential-refresh.txt BedrockTest STS calls for five Bedrock calls at three credential lifetimes
06-bedrock-pod-identity.txt BedrockTest EKS Pod Identity: the same application, the container credentials endpoint
07-azure-managed-identity.txt AzureTest Bearer token from the identity endpoint, no api-key header
07b-azure-leftover-api-key.txt AzureTest A leftover OPENAI_API_KEY in the environment turns Entra ID off (profile azure-default)
08-azure-token-refresh.txt AzureTest Identity endpoint calls for five chat calls at three token lifetimes
09-azure-without-azure-identity.txt AzureTest The failure when azure-identity is not on the classpath
10-azure-identity-failure.txt AzureTest An unusable managed identity, and the audited failure
11-startup-trap.txt CommonTest Other modalities default to OpenAI and stop startup
12-audit-and-secret-hygiene.txt CommonTest Audit lines, and a search of the logs for every secret the run handled

The article walks through all of this in one page: Spring AI on Amazon Bedrock and Azure OpenAI: Keyless Auth with IAM Roles and Entra ID.