To configure Gmail for the Next Generation API Data Protection, follow the instructions below.
Prerequisite
Before configuring Gmail for the Next Generation API Data Protection, review the prerequisites.
-
A Google Workspace with Business Standard or Business Plus edition license.
-
A Google super admin account to create a custom role and user for Netskope integration.
-
If you have guest or external users in your SaaS environment belonging to domains considered internal, you must set the appropriate internal domains for Netskope to classify exposure accurately. To set up internal domains, follow this article.
Create and Assign Custom Role for Netskope
If you do not plan to use the Google super admin account, you can create a custom role and assign the role to a user to grant access to Next Generation API Data Protection. You can grant privileges / scopes using the default Google super admin role or by creating a custom role exclusively for the Netskope integration. This section describes the steps to create a custom role for Netskope.
-
Log in to admin.google.com as a super admin.
-
Click the triple bar on the top-left corner of the home page and navigate to Account > Admin roles.
-
Click Create new role.
-
Enter a name and description for the role and click CONTINUE.
-
Select the admin privilege for the role:
Netskope does not recommend removing the following privileges. Any removal may result in failure of API calls and policy processing.Here is a list of privileges Netskope requires:
Privileges Needed for Domain Management This privilege is required to list the domains under the Google workspace. Netskope uses the
domains list to determine if a user is internal or external.Groups > Read This privilege is required to get group information. Users > Read This privilege is required to get user information. -
Click CONTINUE, and then click CREATE ROLE.
Once you have created the custom role, you can assign the role to a user. To assign the role to account, navigate to Directory > Users, click the user account, navigate to Admin roles and privileges, and assign the role you created above. The user can then authorize Netskope to grant access to your Gmail instance.
Create a Google Cloud Platform (GCP) Project
Create a GCP that you own. This project will host the service account Netskope uses to access your Google workspace data.
-
Follow Create a Google Cloud project in google documentation to create a GCP project in Google cloud console.
-
Once created, copy the Project ID. This will be required when you set up the Gmail instance on the Netskope tenant.
Enable Google APIs
Enable the required APIs for Gmail integration with Next Generation API Data Protection. Log in to console.cloud.google.com. In the same project you created, search for each API by name in the top search bar and click Enable:
-
Admin SDK API
-
Gmail API
-
Cloud Pub/Sub API
Create a Service Account
Create the Google cloud service account Next Generation API Data Protection will use to access your data, then generate and download its credentials.
-
In the same GCP project, go to Service Accounts, click + Create service account.
-
Give it a name and description.
Suggested name:
ng-casb-api-gmailand description:Service account for CASB Gmail -
Click Create and close.
-
Click the new service account and on the Details tab, copy the Email and Unique ID (your client ID).
The email ID will be required when you set up the Gmail instance on the Netskope tenant. The unique ID will be required for domain-wide delegation.
-
Grant the service account the Pub/Sub Admin role:
-
On the Permissions tab, click Manage access.
-
Click + Add role and under Select a role, search and choose Pub/Sub Admin.
-
Click Save.
-
-
On the Keys tab, click Add Key > Create new key, choose JSON, and download it.
Keep the
private_keyvalue handy. The key will be required when you set up the Gmail instance on the Netskope tenant.If you see a message Service account key creation is disabled, follow the troubleshooting steps documented in this Google article.
Grant Scopes to the Service Account
This section describes the steps required to authorize your service account with the domain-wide delegation scopes Netskope needs to access data in Gmail.
-
Log in to admin.google.com as a super admin.
-
Navigate to Security > Access and data control > API controls.
-
On the API controls page, under Domain wide delegation, click Manage Domain Wide Delegation.
-
Click Add new.
A new pop-up window opens.
-
For Client ID, enter the Unique ID of the service account you just created.
-
For OAuth scopes, enter the following scopes:
Enter one scope per line.-
https://www.googleapis.com/auth/admin.directory.user.readonly -
https://www.googleapis.com/auth/admin.directory.domain.readonly -
https://www.googleapis.com/auth/gmail.readonly -
https://www.googleapis.com/auth/admin.directory.group.member.readonly -
https://www.googleapis.com/auth/admin.directory.group.readonly -
https://www.googleapis.com/auth/admin.reports.audit.readonly
-
-
Click Authorize.
-
Verify the steps above by checking that your service account appears in the API clients list.
Configure Gmail Instance in Netskope UI
To authorize Netskope to access your Gmail instance, follow the steps below:
-
Log in to the Netskope tenant UI and go to Settings > Configure App Access > Next Gen > CASB API.
-
Under Apps, select Gmail and click Setup CASB API Instance.
The Setup Instance window opens.
-
Under API Admin Email, enter the Google account email of the super admin or a user with a custom role (see Create and Assign Custom Role for Netskope).
-
Under Administrator Email, enter the email address of the user who will receive an email notification when a policy violation or event triggers. This step is optional.
-
Under Service Account Email, enter the service account’s email (step 4 of Create a Service Account or
client_emailin the JSON key). -
Under Service Account Private Key, enter the
private_keyvalue from the JSON key.Copy from-----BEGIN PRIVATE KEY-----ton-----END PRIVATE KEY-----\n. -
Under Project ID, enter your GCP Project ID (step 2 of Create a Google Cloud Platform (GCP) Project).
-
Under Instance Name, enter a name of the SaaS app instance. This step is optional and if left blank, Netskope will determine the name of the app instance post grant.
-
Click Grant Access. You will be prompted to log in using a super admin or a user with a custom role and password, and then click Sign In. When the configuration results page opens, click Close.
Refresh your browser and you will see a green check icon next to the instance name.
Next, you should configure a Next Generation API Data Protection policy. To do so, see Create a Next Generation API Data Protection Policy.

