Google Workspace Directory
This article will help you get started using Directory Connector to sync users and groups from your Google Workspace (formerly "G Suite") Directory to your Bitwarden organization.
To setup directory sync with Google Workspace (formerly "G Suite"), you will need access to the Google Workspace Admin Console and Google Cloud Platform Console. Directory Connector will require information obtained from these processes to function properly.
Complete the following steps to create a Google Cloud project to use to connect Directory Connector to your directory. If you already have a Google Cloud project available, skip to Enable Admin SDK:
In the GCP Console, use the left-hand navigation to select IAM & Admin → Manage Resources.
Select the Create Project button.
On the New Project screen:
Enter a Bitwarden-specific name for the project (for example,
bitwarden-dc-project).Choose an organization to attach it to the project.
Choose the parent organization or folder.
Select Create.
Complete the following steps to enable the Admin SDK API, to which Directory Connector will make requests:
In the GCP Console, open the created or pre-existing project.
From the left-hand navigation, select APIs & Services → Library.
In the search box, enter
Admin SDKand open the Admin SDK API service.Select the Enable button.
Complete the following steps to create a service account to use when making API calls:
In the GCP Console, select the created or pre-existing project.
From the left-hand navigation, select APIs & Services → Credentials.
Select the Create Credentials button, and select Service account from the dropdown.
Fill in the Service account details section, and select the Create and continue button.
In the Grant this service account access to project section, select Project → Owner from the Role dropdown and select the Continue button.
Select the Done button.
Complete the following steps to obtain the appropriate permissions for the created service account:
In the GCP Console, open the created or pre-existing project.
From the left-hand navigation, select IAM & Admin → Service Accounts.
Select the created or pre-existing service account.
From the Keys tab, select the Add Key button and select Create new key from the dropdown.
Select the Key type JSON and select the Create button to download a JSON-formatted key to your local machine.
Back on the Details tab of the service account, select the Advanced settings drop-down.
Scroll to the Google Workspace Marketplace OAuth Client section and select Create Google Workspace Marketplace-Compatible OAuth Client, or, if you see box that reads "An OAuth consent screen must be configured in order to create an OAuth client.", select Configure.
Select Get Started and in the project configuration:
Enter the name of the app asking for consent (e.g.
Bitwarden Directory Connector).Choose a user support email.
In the Audience section, choose Internal.
Continue through the wizard to create the consent screen.
Once created, open the Data Access tab and select Add or remove scopes.
In the Manually add scopes section, paste the following:
Plain Texthttps://www.googleapis.com/auth/admin.directory.user.readonly,https://www.googleapis.com/auth/admin.directory.group.readonly,https://www.googleapis.com/auth/admin.directory.group.member.readonlySelect Add to table and then Update.
Click Save.
Using service account credentials with the CLI
If you're going to use the Directory Connector CLI, the JSON-formatted key you've downloaded will be used for the command bwdc config gsuite.key, however intermediary steps are required to allow the CLI to use the private key found in the key file:
On Linux, run the command
bwdc config gsuite.key "\n$(cat projectid-key.json | jq -r '.private_key')", being sure to replaceprojectid-key.jsonwith the name of your.jsonfile, which is typically a combination of the Project ID and Key.On other OSs:
Copy the value of
private_keyinto a separate.crtfile, for example namedgoogle-bwdc-key.crt.Run the command
bwdc config gsuite.key "\n$(cat google-bwdc-key.crt)\n", being sure to replace the.crtfile name with the one you've created.
Complete the following steps to authorize the client to read your directory:
Open the Google Admin Console.
From the left-hand navigation, select Security → Access and data control → API controls.
Select the Manage Domain Wide Delegation button.
Select the Add new button.
In the Client ID field, paste the created Unique ID you can find by opening the GCP Console, navigating to API & Services → Credentials, opening your service account and looking for the Unique ID.
In the OAuth scopes field, paste the following value to grant only read-access:
Bashhttps://www.googleapis.com/auth/admin.directory.user.readonly,https://www.googleapis.com/auth/admin.directory.group.readonly,https://www.googleapis.com/auth/admin.directory.group.member.readonlySelect the Authorize button.
Complete the following steps to configure Directory Connector to use your Google directory:
Open the Directory Connector desktop app.
Navigate to the Settings tab.
From the Type dropdown, select G Suite (Google).
The available fields in this section will change according to your selected type.
Enter the Domain of your Google account.
Enter the email address of an Admin User with full access to your Google directory.
If you have one, enter the Customer ID of your directory. Many users will not have or be required to enter a Customer ID.