The Simplest Way to Make Azure Key Vault and Cloud Run Work Like They Should
Integrating azure key vault and cloud run lets serverless containers read external secrets at runtime. This setup helps multi-cloud teams store keys in Microsoft Azure while running apps on Google Cloud. Many teams split their stack across multiple cloud providers. Security teams often keep all keys and certificates inside Azure. At the same time, app teams may run stateless containers on Google Cloud. Linking these two platforms requires a clean identity flow across cloud borders. When done ri
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Integrating azure key vault and cloud run lets serverless containers read external secrets at runtime. This setup helps multi-cloud teams store keys in Microsoft Azure while running apps on Google Cloud.
Many teams split their stack across multiple cloud providers. Security teams often keep all keys and certificates inside Azure. At the same time, app teams may run stateless containers on Google Cloud. Linking these two platforms requires a clean identity flow across cloud borders. When done right, containers fetch secrets at startup without storing static keys in code.
How identity and secrets flow between azure key vault and cloud run
To link azure key vault and cloud run, you must bridge two identity systems. Each Cloud Run service runs under a dedicated Google service account. That service account can request an OpenID Connect token from the Google metadata server. Your container sends this signed token to Microsoft Entra ID to prove its identity.
Microsoft Entra ID checks the token against a federated identity rule you set up. Once the check passes, Azure issues a short-lived token back to the container. The app then uses this Azure token to read the secret from the vault. No static client secrets or certificates ever sit inside your container image. The whole exchange happens over HTTPS before the app starts serving user traffic.
Common failure modes and how to scope roles
The biggest mistake teams make is pasting static Azure client secrets into environment variables. Static keys do not expire on their own and often leak into build logs. If an attacker steals that variable, they can read your vault from anywhere. Federated workload identity removes this risk by trading signed tokens at runtime.
Shared service accounts create another big risk for multi-cloud teams. If ten Cloud Run services share one Google identity, they share the same vault permissions. A bug in one small app could expose database keys meant for another app. Give every Cloud Run service its own Google service account and Azure app registration.
Azure Key Vault + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Broad vault permissions also cause problems during audits. Do not grant a container read rights to every secret in an Azure vault. Use role-based rules in Azure to scope permissions down to single secret names. Also, turn on audit logs in both clouds so you can trace every secret read.
Managing runtime secret caching and rotation
Cloud Run spins up new container instances fast when traffic spikes. If thousand of instances call Azure at once, you might hit rate limits. Have your app read the secret once at startup and keep it in memory. When you rotate a key in Azure, deploy a new Cloud Run revision or refresh the cache on a timer.
Network timeouts can also break container startups across clouds. Set clear retry rules in your startup code when calling the Azure endpoint. If a secret read fails, the container should log the error and exit right away. This prevents broken instances from taking live user requests without valid database keys.
Add runtime guardrails and masking beside your databases and APIs
Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.
Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.
Frequently asked questions
How do I authenticate from Cloud Run to Azure without static keys?
Use workload identity federation between Google Cloud and Microsoft Entra ID. Your Cloud Run service account trades its Google OIDC token for a temporary Azure token.
Should Cloud Run read Azure secrets on every user request?
No, reading from Azure on every request adds high latency and hits rate limits. Fetch the secret once when the container starts and store it in memory.
How can I restrict which secrets a specific Cloud Run service can read?
Create a unique Google service account for that single Cloud Run service. Map it to a specific Azure role that only allows reading the exact secrets needed.
Related guides
In this post