Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
- On the top left of your screen, click Start lab to begin
Deploy the application to App Engine
/ 25
Restrict access with IAP
/ 25
Allow member to access application
/ 25
Access User Identity Information
/ 25
Deploy the application to App Engine
/ 25
Restrict access with IAP
/ 25
Allow member to access application
/ 25
Access User Identity Information
/ 25
In the Zero Trust security model, no person, device, or network is inherently trusted. Granting access depends on numerous factors, including identity, device, location, and time of day. A primary use case for Zero Trust policy enforcement is providing secure access to web applications. These include HTTP/HTTPS-based applications hosted on Google Cloud or in on-premises data centers. Each web application can have its own access control for precise security and lower risk. Securing the web application doesn't require setting access control lists (ACLs). Instead, setting IP ranges allows for rapid onboarding without compromising security. Architecturally, the primary component that provides Zero Trust access is:
In this lab, you deploy a sample application to App Engine and enforce policies using Identity-Aware Proxy (IAP). You also obtain user identity information in the application protected by IAP.
In this lab, you learn how to perform the following tasks:
Basic programming knowledge (Python).
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources are made available to you.
This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
Click the Start Lab button. If you need to pay for the lab, a dialog opens for you to select your payment method. On the right is the Lab setup and access panel with the following:
Note that the lab timer is located near the top of the page, showing the remaining time.
Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).
The lab spins up resources, and then opens another tab that shows the Sign in page.
Tip: Arrange the tabs in separate windows, side-by-side.
If necessary, copy the Username below and paste it into the Sign in dialog.
You can also find the Username in the Lab setup and access panel.
Click Next.
Copy the Password below and paste it into the Welcome dialog.
You can also find the Password in the Lab setup and access panel.
Click Next.
Click through the subsequent pages:
After a few moments, the Google Cloud console opens in this tab.
Cloud Shell is a virtual machine that is loaded with development tools. It offers a persistent 5GB home directory and runs on the Google Cloud. Cloud Shell provides command-line access to your Google Cloud resources.
Click Activate Cloud Shell at the top of the Google Cloud console.
Click through the following windows:
When you are connected, you are already authenticated, and the project is set to your Project_ID,
gcloud is the command-line tool for Google Cloud. It comes pre-installed on Cloud Shell and supports tab-completion.
Output:
Output:
gcloud, in Google Cloud, refer to the gcloud CLI overview guide.
You build a minimal web application with App Engine. You then explore ways to use Identity-Aware Proxy to restrict access to the application and provide user identity information to it. Your app:
The application is an App Engine standard environment application written in Python 3.8 that displays a "Hello, World" welcome page. In this task, you deploy and test the application, and then restrict access to it using IAP.
1-HelloWorld folder:The application code is in the main.py file. It uses the Flask web framework to respond to web requests with the contents of a template. That template file is in templates/index.html, and for this step, it contains only plain HTML. A second template file contains a skeletal example privacy policy in templates/privacy.html.
There are two other files: requirements.txt lists all the non-default Python libraries the application uses, and app.yaml tells Google Cloud that this is a Python 3.8 App Engine application.
You can list each file in Cloud Shell using the cat command:
You can also open the Cloud Shell Editor by clicking Edit () in the Cloud Shell toolbar to examine the code.
You don't need to change any files for this step.
In this subtask, you deploy the application to the App Engine standard environment for Python.
In the Cloud Shell Editor, open the app.yaml file in the 1-HelloWorld folder.
Update the Python runtime version and add automatic_scaling with max_instances: 1 so that deployments stay within the project's App Engine max instances quota:
Y and press ENTER.In a few minutes, the deployment finishes, and a message indicates that you can view your application.
Click Check my progress to verify the objective.
The Identity-Aware Proxy API is already enabled for you, so you don't need to click Enable API.
To configure your project's OAuth consent screen, on the Navigation menu, click APIs & Services > OAuth consent screen.
On the OAuth Overview page, click Get Started.
For App name, type IAP Example
For User support email, select
For Audience Type, select Internal.
Click Next.
Under Contact Information, type
Click Next.
Under Finish, select the Accept terms and conditions checkbox.
Click Create.
Return to the first browser tab, and then in Cloud Shell, run the following command:
On the OAuth Overview page, click Create Auth Client.
For Application type, select Web Application.
Under Authorized redirect URIs, click Add URL.
Paste the URL from the Cloud Shell command output.
Click Create.
In the remaining tab, on the Navigation menu, click View all products > Security > Identity-Aware Proxy.
You might need to refresh the page.
To open the application, press and hold CTRL (or COMMAND on macOS), and then click the URL of the App Engine application on the Identity-Aware Proxy page.
Sign in with the student account listed in the sign-in form.
A page appears stating that you don't have access to the application.
You've successfully protected your app with IAP, but you haven't yet told IAP which accounts to allow.
Click Check my progress to verify the objective.
To return to the Identity-Aware Proxy page, on the Navigation menu, click View all products > Security > Identity-Aware Proxy.
Select the checkbox next to App Engine app.
In the info panel, click Add Principal.
Copy the Username from the lab details panel.
For New principals, paste the copied username.
Select the Cloud IAP > IAP-secured Web App User role.
The "Policy Updated" message appears.
Click Check my progress to verify the objective.
You should now see your web app because you already signed in with an authorized user.
However, you might still see the "You don't have access" page because IAP might not recheck your authorization due to a stored login cookie.
In that case, complete the following steps:
/_gcp_iap/clear_login_cookie appended to the end (for example, https://iap-example-999999.appspot.com/_gcp_iap/clear_login_cookie).A new Sign in with Google screen appears with your account already listed.
Click Use another account.
Re-enter your credentials.
These steps cause IAP to recheck your access, and you should now see your application's home screen.
After an app is protected with IAP, it can use the identity information that IAP provides in the web request headers. In this task, the application retrieves the signed-in user's email address and a persistent unique user ID assigned by Google Identity Service. It then displays that data on the welcome page.
In the Cloud Shell Editor, open the app.yaml file in the 2-HelloUser folder.
Update the Python runtime version and add automatic_scaling with max_instances: 1:
If prompted to continue, type Y and press ENTER.
When the deployment is ready, run the following command:
If a new tab doesn't open in your browser, then copy the displayed link and open it in a new tab. You should see a page similar to the following:
Click Check my progress to verify the objective.
The 2-HelloUser folder contains the same set of files as in the 1-HelloWorld folder, but two of the files have been changed: main.py and templates/index.html. The program has been changed to retrieve the user information that IAP provides in request headers, and the template now displays that data.
main.py file:There are two lines in main.py that get the IAP-provided identity data:
The X-Goog-Authenticated-User- headers are provided by IAP, and the names are case-insensitive, so they can be in all lowercase or all uppercase if preferred. The render_template statement now includes those values so they can be displayed:
The index.html template can display those values by enclosing the names in double curly braces:
The provided data is prefixed with accounts.google.com:, showing where the information came from. Your application can remove everything up to and including the colon to get the raw values if desired.
You have learned how to use Identity-Aware Proxy (IAP) to secure HTTP(S) applications deployed to Google Cloud.
...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Manual Last Updated on November 20, 2026
Lab last tested November 20, 2026
Copyright 2026 Google LLC. All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
This content is not currently available
We can notify you via email when it becomes available
Great!
We can contact you via email if it becomes available
One lab at a time
Confirm to end all existing labs and start this one