Google Workspace with NetBird Self-Hosted
This guide is a part of the NetBird Self-hosting Guide and explains how to integrate self-hosted NetBird with Google Workspace.
Beginning with NetBird version v0.23.6 and onwards, the Google Workspace IdP manager no longer requires the creation of a custom admin role called User and Schema Management.
Instead, we are transitioning towards a more tailored role explicitly designed for managing read-only user information.
Consequently, you have the option to remove the previously established custom admin role and refer to the documentation to configure the admin role scope for read-only access correctly.
Before you start creating and configuring an Google Workspace application, ensure that you have the following:
- An Google Workspace account: To create an Google Work application, you must have an Google Workspace. If you don't have one, sign up at https://workspace.google.com/business/signup/welcome.
- User account with admin permissions: You must have an Google Workspace user account with the admin permissions to create and manage Google Workspace applications. If you don't have the required permissions, ask your workspace administrator to grant them to you.
- Create new
Netbirdproject in Google cloud console https://console.cloud.google.com. - Enable
Admin SDK APIforNetbirdproject at https://console.cloud.google.com/apis/library/admin.googleapis.com.
Step 1: Configure OAuth consent screen
- Navigate to OAuth consent page
- Select
InternalUser Type and click create

- Fill in the form with the following values and click
SAVE AND CONTINUE- App name:
Netbird - User support email:
<administrator email address> - Authorized domain:
<your netbird domain> - Developer contact information:
<developer email address>
- App name:
- Click
ADD OR REMOVE SCOPES - Select
/auth/userinfo.email,/auth/userinfo.profileandopenidscopes and then clickUPDATE

- Click
SAVE AND CONTINUE - Verify the summary of the OAuth consent screen to ensure that everything is properly configured, and then click
BACK TO DASHBOARD

Step 2: Create OAuth 2.0 credentials
- Navigate to API Credentials page
- Click
CREATE CREDENTIALSat the top and selectOAuth client ID - Fill in the form with the following values and click
CREATE- Application type:
Web application - Name:
netbird - Authorized JavaScript origins:
https://<your netbird domain>andhttp://localhost - Authorized redirect URIs:
https://<your netbird domain>/auth,https://<your netbird domain>/silent-authandhttp://localhost:53000
- Application type:

- Take note of
Client IDandClient Secretand clickOK

Step 3: Create service account
- Navigate to API Credentials page
- Click
CREATE CREDENTIALSat the top and selectService account - Fill in the form with the following values and click
CREATE- Service account name:
netbird - Service account ID:
netbird
- Service account name:
- Take note of service account email address, we will use it later
- Click
DONE

Step 4: Create service account keys
- Navigate to API Credentials page
- Under
Service Accountsclick thenetbirdto edit the service account

- Click the
Keystab - Click the
Add keydrop-down menu, then selectCreate new key - Select
JSONas the Key type and clickCreate
When you create a service account key by using the Google Cloud console, most browsers immediately download the new key and save it in a download folder on your computer. Read how to manage and secure your service keys here
- Open downloaded json file and take note of
client_idwill be used later asService Account Client ID
Step 5: Grant user management admin role to service account
- Navigate to Admin Console page
- Select
Accounton the left menu and then clickAdmin Roles - Click
Create new role - Fill in the form with the following values and click
CREATE- name:
User Management ReadOnly - description:
User Management ReadOnly
- name:
- Click
CONTINUE

- Scroll down to
Admin API privilegesand add the following privileges- Users:
Read
- Users:
- Click
CONTINUE

- Verify preview of assigned Admin API privileges to ensure that everything is properly configured, and then click
CREATE ROLE - Click
Assign service accounts, add service account email address and then clickADD

- Click
ASSIGN ROLEto assign service account toUser Management ReadOnlyrole

-
Navigate to Account Settings page and take note of
Customer ID -
Encode service account json key into base64 format
base64 -i <SERVICE_ACCOUNT_KEY_PATH> -
Set properties in the
setup.envfile:
NETBIRD_DOMAIN="<YOUR_DOMAIN>"
NETBIRD_AUTH_OIDC_CONFIGURATION_ENDPOINT="https://accounts.google.com/.well-known/openid-configuration"
NETBIRD_USE_AUTH0=false
NETBIRD_AUTH_AUDIENCE="<OAUTH_CLIENT_ID>"
NETBIRD_AUTH_CLIENT_ID="<OAUTH_CLIENT_ID>"
NETBIRD_AUTH_CLIENT_SECRET="<OAUTH_CLIENT_SECRET>"
NETBIRD_AUTH_SUPPORTED_SCOPES="openid profile email"
NETBIRD_AUTH_REDIRECT_URI="/auth"
NETBIRD_AUTH_SILENT_REDIRECT_URI="/silent-auth"
NETBIRD_TOKEN_SOURCE="idToken"
NETBIRD_AUTH_DEVICE_AUTH_PROVIDER="none"
NETBIRD_MGMT_IDP="google"
NETBIRD_MGMT_IDP_SIGNKEY_REFRESH=true
NETBIRD_IDP_MGMT_EXTRA_SERVICE_ACCOUNT_KEY="<BASE64_SERVICE_ACCOUNT_KEY>"
NETBIRD_IDP_MGMT_EXTRA_CUSTOMER_ID="<GOOGLE_WORKSPACE_CUSTOMER_ID>"
Step 6: Continue with the NetBird Self-hosting Guide
You've configured all required resources in Google Workspace. You can now continue with the NetBird Self-hosting Guide.

