Google Workspace: Disable Accounts
This guide helps you set up your Google Workspace device and grant necessary permissions so that you can enable the Disable Accounts auto remediation in Workbench.
This guide is the first step of a larger process to enable auto remediations. After completing the steps on this page, you will be instructed to return to the Enable an Auto Remediation in Workbench guide to finish your setup.
How It Works
If our SOC identifies an account (username or email address) that is compromised and must be disabled, Workbench completes the action automatically and logs the user out of their session. You have the option to restrict these actions to specific accounts by configuring an allow or deny list (the accounts must first be added as context, and then the list can be configured in Workbench; see Step 3).
Endpoints Used
Google Admin SDK Directory API
admin/directory/v1, via the google-api-python-client SDK
GET (users.get)
admin/directory/v1/users/{userKey}
Look up the user and read the current suspended flag
POST (users.signOut)
admin/directory/v1/users/{userKey}/signOut
Sign the user out of all sessions (must run before suspend)
PUT (users.update)
admin/directory/v1/users/{userKey}
Suspend the account
Session revocation and suspension are two separate calls. users.signOut invalidates all web/device sign-in sessions (done first because it is not allowed once suspended); it does not revoke third-party OAuth app grants. Revert sets suspended: false (no users.signOut on revert); requires a write scope (admin.directory.user) on the device.
Step 1: Add OAuth Scopes to Google
Open the Google Workspace admin console: https://admin.google.com/ac/owl/domainwidedelegation.
Navigate to Security > API Controls > Manage Domain Wide Delegation.
Select Edit next to the Expel API client.
Scroll to the bottom and add the following OAuth scopes:
https://www.googleapis.com/auth/admin.directory.user
https://www.googleapis.com/auth/admin.directory.user.security

Select Authorize.
Step 2: Add OAuth Scopes to Workbench
In a new browser tab, log in to Workbench.
Navigate to Organization Settings > Security Devices.
Find Google Workspace in the list.
Select the down arrow in the Google Workspace row, and select View & Edit.
Scroll to the end of API scopes field and add the OAuth scopes:
https://www.googleapis.com/auth/admin.directory.user
https://www.googleapis.com/auth/admin.directory.user.security

Select Save.
Step 3: Update Your Context
If you do not want to specify any accounts for a "do not disable" or "always disable" list, and instead wish for Expel to automatically disable all identified accounts, skip to Step 4.
Working with your Customer Success Manager, prepare to create an allow or deny list by adding accounts as org context for your environment. You will then be able to select those accounts as "Never disable" or "Always disable" assets when you enable the auto remediation in Workbench.
Step 4: Return to the Main Setup Guide
Your Google Workspace device is now ready for the Disable Accounts auto remediation. You should now do one of the following:
If you do not need to set up any other devices for this auto remediation, you can return to the Enable an Auto Remediation in Workbench guide to finish Step 2 of the process.
If you need to set up additional devices for this auto remediation, or wish to use this device with multiple auto remediations, be sure to complete those setup guides as well before returning to the Enable an Auto Remediation in Workbench guide to finish Step 2 of the process. Make sure to follow the setup guide that is specific to your auto remediation, as device setup instructions are unique to each auto remediation and device.
Last updated
Was this helpful?

