The Simplest Way to Make Azure App Service and Google Pub/Sub Work Like They Should

Published
Length
4 min read

Luis Felipe Dias

All posts

Teams use azure app service and google pub/sub to send events across clouds. Your web app hosts the code while the message queue moves data between services. This setup lets teams run web apps in one cloud and process data elsewhere. You do not need to move all your workloads to a single provider. Instead, the web app sends messages to a topic when users take action. Worker services in the other cloud then read those messages and run background jobs. How identity and data flow between azure a

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.

Teams use azure app service and google pub/sub to send events across clouds. Your web app hosts the code while the message queue moves data between services.

This setup lets teams run web apps in one cloud and process data elsewhere. You do not need to move all your workloads to a single provider. Instead, the web app sends messages to a topic when users take action. Worker services in the other cloud then read those messages and run background jobs.

How identity and data flow between azure app service and google pub/sub

To make these two services talk, you must first set up cross-cloud trust. Do not put static JSON key files inside your app code or settings. Static keys never expire on their own and create a huge risk if leaked. Instead, use workload identity federation so the two clouds trust each other directly.

First, turn on a managed identity for your web app in the host cloud. This gives your app a built-in identity that the platform manages for you. Next, set up an identity pool in your target cloud project. Tell that pool to trust tokens from your web app tenant and identity.

When your app runs, it asks its local metadata service for a token. It then trades that token for a short-lived token from the target cloud. Your app uses this new token to send or read messages over HTTPS. The data flows over encrypted web traffic directly to the message topic API.

You can also use push subscriptions to send data back to your web app. In this flow, the message service sends an HTTP POST request to your app. Your app checks the attached token to make sure the sender is real. Then the app processes the payload and returns a success code to clear the message.

Common failure modes and how to scope roles and network paths

Many teams make mistakes when they first link these two cloud platforms together. The most common mistake is sharing one service account across many different web apps. If one app has a bug or breach, every topic becomes exposed at once. Give each app its own identity and map it to one single role.

Overbroad roles are another major problem in cross-cloud setups. An app that only sends events does not need full project editor rights. Give a sender app only the publisher role on the exact topic it needs. Give a reader app only the subscriber role on its specific subscription resource.

Service-to-Service Authentication + Azure RBAC: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Unlogged traffic and raw data leaks also cause headaches for security teams. Developers sometimes dump full event payloads into local app logs during a debug session. Those payloads often hold sensitive fields like emails, phone numbers, or card numbers. Data masking rewrites matched fields in results so raw values do not spill into logs.

Network paths between the two clouds also need tight rules and clear limits. By default, your web app reaches the message API over the public internet. For tighter control, place your web app inside a virtual network with outbound rules. Restrict outbound traffic so the app only talks to known cloud API endpoints.

When using push subscriptions, lock down incoming traffic to your web app as well. Do not let just any host on the internet post data to your webhook. Require valid identity tokens on every incoming push request and check the audience claim. Drop any request that lacks a valid signature before your app code reads it.

Handling retries and dead-letter topics across clouds

Cross-cloud calls can fail when network links drop or apps restart during deploys. If your app fails to send a message, it needs a clear retry plan. Use short pauses between retries so your app does not flood the network. Set a strict timeout on every outbound call to keep web threads free.

Incoming push messages also need a safe place to go when processing fails. Attach a dead-letter topic to your subscription to catch poison messages right away. Set a low maximum delivery attempt count so bad events move out of the queue. Your team can then inspect the failed payloads and fix the root cause.

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

How do I connect these services without storing static JSON keys?

Enable a managed identity on your web app and set up workload identity federation. Your app trades its local identity token for a temporary access token at runtime.

What is the safest way to receive messages in a web app?

Use an authenticated push subscription that sends HTTPS POST requests to your app endpoint. Always check the bearer token signature and claims before your code runs the job.

How should I scope roles for cross-cloud messaging?

Assign roles at the single topic or subscription level rather than the project level. Give sending apps only publisher rights and reading apps only subscriber rights.

The query runs. The emails stay hidden.