The Simplest Way to Make Google Pub/Sub and Microsoft Entra ID Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

You can link google pub/sub and microsoft entra id through identity federation. This setup lets users and apps send or read messages without static keys. Teams often use Microsoft for user logins and Google Cloud for event queues. Connecting these two platforms removes the need to store secret files on laptops. Your engineers log in once and work with the queues they need. Apps running outside Google Cloud can also trade identity tokens to move data. How google pub/sub and microsoft entra id

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 can link google pub/sub and microsoft entra id through identity federation. This setup lets users and apps send or read messages without static keys.

Teams often use Microsoft for user logins and Google Cloud for event queues. Connecting these two platforms removes the need to store secret files on laptops. Your engineers log in once and work with the queues they need. Apps running outside Google Cloud can also trade identity tokens to move data.

How google pub/sub and microsoft entra id share roles and data

The link between these two tools relies on OpenID Connect and SAML protocols. Microsoft Entra ID acts as the source of truth for user identities. When a person or app wants to publish a message, Entra issues a token. Google Cloud reads this token through its workload or workforce identity pools.

Google checks the digital signature on the Microsoft token to trust the caller. Next, Google maps group claims from Microsoft to specific Pub/Sub roles. A user in a reader group gets permission to pull messages from one subscription. A billing app in a writer group gets permission to publish to one topic.

No long-lived Google service account keys ever cross the network during this flow. Each token lasts for a short window and expires on its own. Once the identity check passes, data flows straight to the Pub/Sub topic. This design keeps login rules in one directory while data stays in Google.

Common failure modes and how to scope roles

Many teams skip federation at first and share one Google service account key. Developers paste this JSON key into local files and shared chat rooms. When someone leaves the team, nobody rotates the shared key because apps might break. Attackers who find that file can read or poison every topic in the project.

Another common mistake is granting project-wide editor roles to the whole Microsoft group. Broad tokens let any person or script delete topics or read private payloads. Event streams often carry sensitive data like emails, phone numbers, and card numbers. Without data masking to rewrite matched fields in results, raw payloads spread fast.

Microsoft Entra ID (Azure AD) + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Unlogged actions create another blind spot when teams use shared accounts. If five engineers share one service identity, audit logs cannot show who read a message. You fix this by mapping individual Microsoft user claims to separate Google audit tags. Every publish or pull call should record the exact person who ran it.

To scope roles well, assign permissions at the single topic or subscription level. Give apps permission to publish to one topic rather than the whole project. Put network rules in place so only known cloud networks can reach the APIs. Review group memberships in Microsoft every month to drop stale permissions right away.

Keeping developer workflows fast and safe

Local debugging often pushes engineers back toward bad habits with static keys. A developer wants to inspect a dead-letter queue from a laptop to fix a bug. If the login flow takes ten steps, people will find a workaround. Keep the login steps simple so the safe path is also the fast path.

Separate human access from machine access in your identity pools from day one. Machine workloads need strict, unchanging rules tied to one topic or subscription. Human engineers need temporary read or write rights when they fix a live issue. When the fix is done, those extra rights should drop back down to zero.

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

No, you do not need exported JSON keys when you use workload identity federation. Google Cloud trusts short-lived tokens issued by Microsoft Entra ID instead of static secrets.

Can I map Microsoft security groups to a single Pub/Sub topic?

Yes, you can bind a mapped Microsoft group ID to one specific topic or subscription. This setup stops users in that group from touching other queues in your project.

How do I stop raw PII from leaking in message payloads?

You can apply data masking rules that rewrite emails, card numbers, and national IDs in results. This step protects private fields when engineers inspect live queues to fix bugs.

The query runs. The emails stay hidden.