The Simplest Way to Make Active Directory and Cloud Run Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

You pair active directory and cloud run to control who calls your cloud apps. Active Directory stores user groups, and Cloud Run checks those identities before running containers. This setup lets your team use one corporate login for every cloud service. Developers do not need to build custom login pages for each internal tool. Instead, they map existing directory groups to cloud roles and permissions. Your team ships new containers while keeping central user rules intact. How active director

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.

You pair active directory and cloud run to control who calls your cloud apps. Active Directory stores user groups, and Cloud Run checks those identities before running containers.

This setup lets your team use one corporate login for every cloud service. Developers do not need to build custom login pages for each internal tool. Instead, they map existing directory groups to cloud roles and permissions. Your team ships new containers while keeping central user rules intact.

How active directory and cloud run share identity data

These two systems live in very different worlds by default. Active Directory often runs inside corporate data centers or private networks. It uses classic directory protocols and tickets to check user logins. Cloud Run runs stateless containers on Google Cloud and expects modern web tokens.

To bridge them, teams sync directory users and groups to Google Cloud identity services. When a user logs in, the identity provider checks their Active Directory status. It then issues a signed token that proves who the user is. The user sends this token in the request header to the Cloud Run URL.

Cloud Run reads the token and checks the attached cloud role. If the user belongs to the right group, the container handles the request. If the role does not match, the platform blocks the traffic right away. The container code stays clean because the cloud layer handles the login check.

Common failure modes and how to scope roles

Many teams take shortcuts when they first link these two tools. A common mistake is using one shared service account for all incoming traffic. When every user shares one account, your audit logs lose all user context. You cannot tell which person ran a sensitive job or changed a record.

Broad tokens create another big risk for production systems. If a token grants admin rights across an entire project, a leak hurts everything. Attackers can use that wide token to call other containers or read backend data. Unlogged queries also hide bad behavior until a breach causes real damage.

Active Directory + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

You can fix these gaps by scoping roles down to single services. Map specific Active Directory groups to narrow cloud roles that only invoke one service. Never give a human group full admin rights on the container platform. Keep your runtime service accounts separate from your human invoker roles.

Network paths between the two systems also need tight rules. If your container needs to read directory data, use a private network link. Do not expose directory servers to the public internet for cloud checks. Limit network traffic to the exact ports and subnets your identity sync tool needs.

Protecting backend data behind your containers

Securing the container front door is only half of the security puzzle. Once a container runs, it often queries internal databases or calls third-party APIs. Engineers also need to debug these services and check live production data. If you store static database passwords inside container settings, anyone with read rights can take them.

Teams should track every query and command that hits backend systems. You also need a way to protect sensitive fields in query results. For example, masking rewrites matched fields like emails, phone numbers, card numbers, or national IDs. This keeps raw personal data out of support screens and debug logs.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

Can Cloud Run use Active Directory groups directly without syncing?

No, Cloud Run cannot read classic directory groups on its own. You must sync your groups to Google Cloud or use federation with web tokens.

Why should we avoid shared service accounts for team logins?

Shared accounts erase individual user trails in your system logs. When an error or breach happens, you cannot see who sent the request.

How do we restrict which containers a directory group can call?

Bind the synced group to the invoker role on one specific service. Do not grant that role at the broad project or folder level.

The query runs. The emails stay hidden.