Connecting GitLab
Configure a Personal Access Token to automate JIT and lifecycle management for GitLab users
Step 1: Create a Service Account
GitLab integration uses Personal Access Tokens (PAT) from a dedicated account.
Account options:
- Group Service Account (GitLab Premium / Ultimate only)
GitLab’s official service account feature. Recommended when available.
Does not consume a seat license. - Dedicated User Account (All GitLab tiers)
A regular GitLab user created exclusively for automation purposes.
Consumes a seat license.
Both options are supported by Trustle.
Use Group Service Accounts when available; otherwise, use a Dedicated User Account.
Option A: Group Service Account (Recommended - GitLab Premium/Ultimate Only)
Prerequisites:
- GitLab Premium or Ultimate tier (not available on Free tier)
- Owner role in a top-level group on GitLab.com
- For self-hosted: Administrator status OR Owner role with appropriate permissions
Steps:
- Go to your top-level group's service accounts page: https://gitlab.com/groups/{your-group}/-/settings/service_accounts
- Click "Add service account"
- Enter a name (e.g., "trustle-integration")
- Username will auto-generate as service_account_group_{id}_{random} but can be edited
- Click "Create service account"
- CRITICAL: Service accounts do not automatically have access. You must explicitly add them:
- Go to Group → Members: https://gitlab.com/groups/{your-group}/-/group_members
- Click "Invite members"
- Search for the service account username
- Assign role: Owner (recommended for full access)
- Service account will inherit access to subgroups and projects
Important Notes:
- Service accounts do not use a seat license
- Service accounts cannot access the GitLab UI (API and Git operations only)
- Maximum token expiration: 365 days (400 days in GitLab 17.6+)
Option B: Dedicated User Account (For GitLab Free or Self-Hosted Without Service Account Feature)
If you don't have access to Premium/Ultimate or prefer a manual approach:
- Have a GitLab administrator create a new user account:
- Username: e.g., trustle-service or trustle-integration
- Email: Service account email (e.g., trustle-service@company.com)
- Configure the account:
- Set a strong password (will only be used for initial setup)
- Mark as "External user" if you don't want it to have access to internal projects
- For full access to all GitLab users, groups, and projects: Grant Administrator role
- CRITICAL: Add the user account as a member to groups/projects you want to extract:
- Go to each group: Group → Members → Invite members
- Search for the user account username
- Assign role: Owner (recommended for full access)
Limitations of Manual User Accounts:
- Consumes a seat license (unlike service accounts)
- Can access GitLab UI unless separately restricted
- Subject to user-related policies and access controls
Step 2: Generate a Personal Access Token
Group Service Account (GitLab Premium / Ultimate)
- Go to Group Settings → Service Accounts
- Select the service account
- Open the Access Tokens tab
- Click Add new token
- Configure the token:
- Token name: Trustle Acme Integration
- Expiration date: Set according to your security policy (maximum 365 days)
- Scopes: select api
- Click Create personal access token
- Copy the token immediately (it will not be shown again)
Step 3: Set up the integration
- Navigate to the Connections page in Trustle from the left menu
- Under SaaS Applications find the Gitlab logo and choose Connect
- Provide the connection details and Personal Access Token created on Step 2
- Click Test Connection
- Upon successfully testing the connection, click Save Connection
