Skip to main content
Security and Compliance

Identity-Aware Proxy: Zero Trust Access to Internal Apps Without a VPN

Protect internal apps with Google Cloud Identity-Aware Proxy (IAP): how IAP works, Cloud Run and load balancer setup, TCP forwarding for SSH, and access levels.

Last checked against Google's official documentation on .

Identity-Aware Proxy: Zero Trust Access to Internal Apps Without a VPN

Most companies still protect internal tools the old way: put them on a private network and make everyone connect through a VPN first. It works until the VPN client breaks, a contractor needs access for one afternoon, or an attacker who gets onto the VPN finds every internal app open to them. Identity-Aware Proxy (IAP) takes a different approach.

Instead of trusting the network, IAP checks who the user is and what they are allowed to do on every request. If your users already sign in to Google Workspace, they already have the identity IAP needs. This guide explains how IAP works, how to put it in front of web apps and VMs, and how to add device and location rules.

Key Takeaways

  • IAP checks identity and IAM on every request before it reaches your app.
  • Enable IAP directly on Cloud Run where you can; it avoids a load balancer.
  • Use a load balancer for VMs, GKE, and multi-region backends.
  • TCP forwarding gives SSH and RDP to VMs with no public IP.
  • Add access levels for device and network conditions.

Table of contents

Open Table of contents

How Identity-Aware Proxy Works

How Identity-Aware Proxy checks every request

  1. A user opens the app’s URL.
  2. IAP intercepts the request and sends the user to Google sign-in if needed.
  3. IAP checks whether the user holds the IAP-secured Web App User role on the app.
  4. If access levels apply, IAP checks the device or network conditions too.
  5. Only then is the request passed to the app, with headers that identify the user.

The app itself never sees anonymous traffic. If IAP says no, the request stops at Google’s edge.

What IAP Can Protect

ResourceHow IAP is enabled
Cloud Run servicesDirectly on the service, or through a load balancer
App Engine appsDirectly in the IAP page
Compute Engine and GKE web appsThrough an external or internal HTTPS load balancer backend
SSH and RDP to VMsIAP TCP forwarding
On-premises appsThrough a load balancer with hybrid connectivity

Protecting a Cloud Run Service

Google’s IAP documentation recommends enabling IAP directly on the Cloud Run service in most cases. It protects the service’s run.app URL without creating load balancer resources, which saves both setup time and cost.

The essentials:

  1. Enable IAP on the Cloud Run service from the Cloud Run or IAP pages in the console.
  2. Grant the Cloud Run Invoker role to the IAP service agent, service-PROJECT_NUMBER@gcp-sa-iap.iam.gserviceaccount.com, so IAP can call the service.
  3. Grant IAP-secured Web App User to the Workspace group that should have access.
  4. Make sure the service does not also allow unauthenticated invocations.

A few limits from Google’s documentation are worth knowing. By default IAP on Cloud Run uses a Google-managed OAuth client that only admits users in your organization (configure a custom OAuth client for outside users). IAP is not compatible with Cloud CDN, it adds some latency, and if you enable it on a load balancer instead, the run.app URL is not protected, so restrict ingress or disable the default URL in that design.

Use the load balancer approach when a service runs in several regions behind one global backend, or when you want a custom domain with centrally managed access.

Protecting VMs and GKE Behind a Load Balancer

For apps on Compute Engine or GKE:

  1. Put the app behind an external or internal Application Load Balancer with a managed certificate for your domain.
  2. Configure the OAuth consent screen for the project (an Internal app is fine for staff tools).
  3. Enable IAP on the backend service, in the IAP page or with gcloud compute backend-services update BACKEND --iap=enabled.
  4. Grant IAP-secured Web App User to the right group.
  5. Firewall the VMs so they accept traffic only from the load balancer’s ranges.
  6. In the app, verify the signed IAP header so traffic cannot bypass IAP through another path.

SSH and RDP Without Public IPs

IAP TCP forwarding is one of the most useful features in Google Cloud for admins. It lets you SSH or RDP to VMs that have no external IP address.

  1. Create a firewall rule allowing ingress on port 22 (or 3389 for RDP) from Google’s IAP range, 35.235.240.0/20 (2600:2d00:1:7::/64 for IPv6 VMs). Remove the default default-allow-ssh and default-allow-rdp rules, which allow every source address.
  2. Grant the admin group IAP-secured Tunnel User (roles/iap.tunnelResourceAccessor) on the project or specific VMs.
  3. Grant the access needed to log in: Google’s TCP forwarding guide lists Compute Instance Admin (v1) for SSH, or use OS Login roles if you have OS Login enabled.
  4. Connect with:
gcloud compute ssh VM_NAME --zone=asia-south1-a --tunnel-through-iap

For RDP, run gcloud compute start-iap-tunnel VM_NAME 3389 --local-host-port=localhost:LOCAL_PORT --zone=ZONE, leave it running, and point Remote Desktop at localhost:LOCAL_PORT.

Combined with an organization policy that blocks external IPs (see our organization policies guide), this removes the need for bastion hosts and closes port 22 to the internet.

Adding Device and Network Rules

IAP can require access levels defined in Access Context Manager. An access level might require:

  • A request from an approved IP range, such as office networks.
  • A device that is company-owned, encrypted, or running an approved OS version, using endpoint verification.
  • A specific region.

You attach access levels to the IAP role grant with an IAM condition, so different groups can have different rules. Contractors might need an approved IP range, while employees on managed devices can connect from anywhere.

These are the same building blocks behind Context-Aware Access in Google Workspace. Google’s wider zero trust offering, which extends them to web apps and Chrome, is sold as Chrome Enterprise Premium. Our endpoint management guide covers the device side.

Forcing reauthentication for sensitive apps

For apps that hold confidential data, such as an HR system, IAP can make users sign in again after a set time. In the IAP page, open the resource’s Settings and choose Configure reauthentication, or set it with gcloud iap settings set at organization, folder, project or service level. You pick a method (login credentials, an enrolled second factor, or a security key, in rising order of strength) and a maxAge of at least 300 seconds. A MINIMUM policy merges with lower levels and keeps the shorter session and stronger method, while a DEFAULT policy can be overridden lower down.

Google lists some limits: reauthentication works only in browser flows, service accounts and IAP TCP forwarding are exempt, and it doesn’t support external identities, Workforce Identity Federation users or allUsers.

Rolling Out IAP

  1. Start with admin access. Move SSH and RDP to IAP TCP forwarding and remove public IPs.
  2. Protect one internal web app that users access often, such as a wiki or dashboard.
  3. Add access levels for sensitive apps.
  4. Retire VPN access for apps that now sit behind IAP.
  5. Monitor IAP in Cloud Audit Logs. Changes to IAP access policies are Admin Activity logs, while most other IAP operations are Data Access logs, so turn on Data Access audit logs for IAP and filter Logs Explorer on protoPayload.serviceName="iap.googleapis.com". The authorizationInfo.granted field shows whether IAP allowed a request, but Google notes the access level that blocked a request is not listed.

Common Mistakes

  • Leaving another path open, such as a public IP on the backend VM or unauthenticated Cloud Run access.
  • Granting access to individuals instead of groups.
  • Not verifying the IAP header in the application.
  • Opening IAP’s range to all ports instead of just 22 or 3389.

Troubleshooting IAP

Users see “You don’t have access.” They signed in successfully but lack the IAP-secured Web App User role, or an access level is not satisfied. Check the role on the app and the conditions attached to it. Remember that group membership changes can take a few minutes to apply.

The app returns 403 after IAP lets the user through. For Cloud Run, the IAP service agent probably lacks Cloud Run Invoker on the service. For load balancer backends, check that firewall rules allow the load balancer’s ranges.

Sign-in loops or OAuth errors. The OAuth consent screen is missing or misconfigured. For staff apps, use an Internal app with the correct support email.

SSH through IAP times out. The firewall rule for 35.235.240.0/20 on port 22 is missing, the VM has no route for return traffic, or the user lacks IAP-secured Tunnel User. Run the connection with --troubleshoot to see which check fails:

gcloud compute ssh VM_NAME --zone=asia-south1-a --tunnel-through-iap --troubleshoot

Service-to-service calls fail behind IAP. Machine clients must present an OpenID Connect token for IAP’s OAuth client. Where possible, keep internal service-to-service calls on Cloud Run’s own IAM rather than routing them through IAP.

IAP Versus a VPN

VPNIdentity-Aware Proxy
Trust decisionNetwork locationIdentity, role, and device per request
User experienceInstall and connect a clientOpen the URL and sign in
Contractor accessNetwork-wide once connectedPer app, with expiry through IAM conditions
Audit trailConnection logsPer-request allow and deny decisions
OffboardingRevoke VPN credentials separatelySuspend the Workspace account

A VPN is still useful for legacy protocols and site-to-site links. For web apps and admin access, IAP is simpler and safer.

Verifying the IAP Header in Your App

IAP adds a signed JSON Web Token to each request in the x-goog-iap-jwt-assertion header. Verifying it inside the app protects against any path that bypasses IAP, such as a misconfigured firewall. In Python, with Google’s auth library:

from google.auth.transport import requests
from google.oauth2 import id_token

def verify_iap(iap_jwt, expected_audience):
    decoded = id_token.verify_token(
        iap_jwt,
        requests.Request(),
        audience=expected_audience,
        certs_url="https://www.gstatic.com/iap/verify/public_key",
    )
    return decoded["email"]

The expected audience depends on the setup, for example the backend service ID behind a load balancer. Google’s IAP documentation lists the audience format for each resource type. Reject any request where verification fails, and log the user’s email from the verified token for your own audit trail.

Conclusion

Identity-Aware Proxy replaces “who is on the network” with “who is this user and should they see this,” which is a much better question to ask. Start with SSH and RDP, move a few internal apps behind it, and add device rules where the data is sensitive.

Because IAP uses the same identities as Google Workspace, suspending a user in the Admin console removes their access to every IAP-protected app at once. Tomorrow’s guide moves to DNS: managing your Workspace email records in Cloud DNS.


Official Google documentation:

Related reading:

This guide contains referral or affiliate links. If you sign up through one, Workspace Blog may earn a commission at no extra cost to you. Read our referral and advertising disclosure.

Frequently Asked Questions

What is Identity-Aware Proxy in Google Cloud?
Identity-Aware Proxy (IAP) checks a user's Google identity and IAM permissions before letting a request reach your application or VM. Users sign in with their Workspace or Cloud Identity account instead of connecting to a VPN, and access can also depend on device and network conditions.
Can IAP protect Cloud Run without a load balancer?
Yes. Google's documentation recommends enabling IAP directly on the Cloud Run service where possible, which protects the run.app URL without load balancer resources or costs. A load balancer is still the better choice when one backend serves several regions and needs central access management.
Which role do users need to access an IAP-protected app?
Users or groups need the IAP-secured Web App User role on the app or project. For SSH and RDP through IAP TCP forwarding, they need the IAP-secured Tunnel User role plus permission to log in to the VM.
Can I use IAP for SSH without public IP addresses?
Yes. IAP TCP forwarding tunnels SSH and RDP traffic to VMs that have only internal IP addresses. You allow ingress from Google's IAP range on the required port in your firewall rules and grant users the IAP-secured Tunnel User role.
How does IAP relate to Context-Aware Access?
IAP can enforce access levels from Access Context Manager, such as requiring a company-managed device or an approved IP range. These are the same building blocks used by Context-Aware Access for Google Workspace, and the wider zero trust offering is Chrome Enterprise Premium.