SAML Group Sync
- Tier: Premium, Ultimate
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
Use SAML group sync to assign users with specific roles to existing GitLab groups, based on the users’ group assignment in the SAML identity provider (IdP). With SAML group sync you can create a many-to-many mapping between SAML IdP groups and GitLab groups.
For example, if the user @amelia
is assigned to the security
group in the SAML IdP,
you can use SAML group sync to assign @amelia
to the security-gitlab
group with Maintainer role,
and to the vulnerability
group with Reporter role.
SAML group sync does not create groups. You have to first create a group, then create the mapping.
On GitLab.com, SAML group sync is configured by default. On GitLab Self-Managed, you must configure it manually.
Role prioritization
Group sync determines the role and membership type of a user in the mapped group.
Multiple SAML IdPs
- Offering: GitLab Self-Managed
When a user signs in, GitLab:
- Checks all the configured SAML group links.
- Adds that user to the corresponding GitLab groups based on the SAML groups the user belongs to across the different IdPs.
The group link mapping in GitLab is not tied to a specific IdP so you must configure all SAML IdPs to contain group attributes in the SAML response. This means that GitLab is able to match groups in the SAML response, regardless of the IdP that was used to sign in.
As an example, you have 2 IdPs: SAML1
and SAML2
.
In GitLab, on a specific group, you have configured two group links:
gtlb-owner => Owner role
.gtlb-dev => Developer role
.
In SAML1
, the user is a member of gtlb-owner
but not gtlb-dev
.
In SAML2
, the user is a member of gtlb-dev
but not gtlb-owner
.
When a user signs in to a group with SAML1
, the SAML response shows that the user is a member of gtlb-owner
, so GitLab sets the user’s role in that group to be Owner
.
The user then signs out and signs back in to the group with SAML2
. The SAML response shows that the user is a member of gtlb-dev
, so GitLab sets the user’s role in that group to be Developer
.
Now let’s change the previous example so that the user is not a member of either gtlb-owner
or gtlb-dev
in SAML2
.
- When the user signs in to a group with
SAML1
, the user is given theOwner
role in that group. - When the user signs in with
SAML2
, the user is removed from the group because they are not a member of either configured group link.
Multiple SAML groups
If a user is a member of multiple SAML groups that map to the same GitLab group, the user is assigned the highest role from any of those SAML groups.
For example, if a user has the Guest role in a group and the Maintainer role in another group, they are assigned the Maintainer role.
Membership types
If a user’s role in a SAML group is higher than their role in one of its subgroups, their membership in the mapped GitLab group is different based on their assigned role in the mapped group.
If through group sync the user was assigned:
- A higher role, they are a direct member of the group.
- A role that is the same as or lower, they are an inherited member of the group.
Automatic member removal
After a group sync, users who are not members of a mapped SAML group are removed from the group. On GitLab.com, users in the top-level group are assigned the default membership role instead of being removed.
For example, in the following diagram:
- Alex Garcia signs into GitLab and is removed from GitLab Group C because they don’t belong to SAML Group C.
- Sidney Jones belongs to SAML Group C, but is not added to GitLab Group C because they have not yet signed in.
Configure SAML Group Sync
Adding or changing a group sync configuration may remove users from the mapped GitLab group,
if the group names don’t match the listed groups
in the SAML response.
To avoid users being removed, before configuring group sync, ensure either:
- The SAML response includes the
groups
attribute and theAttributeValue
value matches the SAML Group Name in GitLab. - All groups are removed from GitLab to disable Group Sync.
If you use SAML Group Sync and have multiple GitLab nodes, for example in a distributed or highly available architecture, you must include the SAML configuration block on all Sidekiq nodes in addition to Rails application nodes.
To configure SAML Group Sync:
- See SAML SSO for GitLab.com groups.
- Ensure your SAML identity provider sends an attribute statement named
Groups
orgroups
.
The value for Groups
or groups
in the SAML response may be either the group name or an ID.
For example, Azure AD sends the Azure Group Object ID instead of the name. Use the ID value when configuring SAML Group Links.
<saml:AttributeStatement>
<saml:Attribute Name="Groups">
<saml:AttributeValue xsi:type="xs:string">Developers</saml:AttributeValue>
<saml:AttributeValue xsi:type="xs:string">Product Managers</saml:AttributeValue>
</saml:Attribute>
</saml:AttributeStatement>
Other attribute names such as http://schemas.microsoft.com/ws/2008/06/identity/claims/groups
are not accepted as a source of groups.
For more information on configuring the required group attribute name in the SAML identity provider’s settings, see example configurations for Azure AD and Okta.
Configure SAML group links
SAML Group Sync only manages a group if that group has one or more SAML group links.
Prerequisites:
- Your GitLab Self-Managed instance must have configured SAML Group Sync.
When SAML is enabled, users with the Owner role see a new menu item in group Settings > SAML Group Links.
- You can configure one or more SAML Group Links to map a SAML IdP group name to a GitLab role.
- Members of the SAML IdP group are added as members of the GitLab group on their next SAML sign-in.
- Group membership is evaluated each time a user signs in using SAML.
- SAML Group Links can be configured for a top-level group or any subgroup.
- If a SAML group link is created then removed, and there are:
- Other SAML group links configured, users that were in the removed group link are automatically removed from the group during sync.
- No other SAML group links configured, users remain in the group during sync. Those users must be manually removed from the group.
To link the SAML groups:
- In SAML Group Name, enter the value of the relevant
saml:AttributeValue
. The value entered here must exactly match the value sent in the SAML response. For some IdPs, this may be a group ID or object ID (Azure AD) instead of a friendly group name. - Choose a default role or custom role in Access Level.
- Select Save.
- Repeat to add additional group links if required.
Manage GitLab Duo seat assignment
- Offering: GitLab.com
Prerequisites:
- An active GitLab Duo add-on subscription
SAML Group Sync can manage GitLab Duo seat assignment and removal based on IdP group membership. Seats are only assigned when there are seats remaining in the subscription.
To configure for GitLab.com:
- When configuring a SAML Group Link, select the Assign GitLab Duo seats to users in this group checkbox.
- Select Save.
- Repeat to add additional group links for all SAML users that should be assigned a GitLab Duo Pro or GitLab Duo Enterprise seat. GitLab Duo seats are unassigned for users whose identity provider group memberships do not match a group link with this setting enabled.
The checkbox does not appear for groups without an active GitLab Duo add-on subscription.
Microsoft Azure Active Directory integration
Microsoft has announced that Azure Active Directory (AD) is being renamed to Entra ID.
For a demo of group sync using Microsoft Azure, see Demo: SAML Group Sync.
Azure AD sends up to 150 groups in the groups
claim.
When using Azure AD with SAML Group Sync, if a user in your organization is a member of more than 150 groups,
Azure AD sends a groups
claim attribute in the SAML response for group overages,
and the user may be automatically removed from groups.
To avoid this issue, you can use the Azure AD integration, which:
- Is not limited to 150 groups.
- Uses the Microsoft Graph API to obtain all user memberships. The Graph API endpoint accepts only a user object ID or userPrincipalName as the Azure-configured Unique User Identifier (Name identifier) attribute.
- Supports only Group Links configured with group unique identifiers (like
12345678-9abc-def0-1234-56789abcde
) when it processes Group Sync.
Alternatively, you can change the group claims to use the Groups assigned to the application option.
Configure Azure AD
As part of the integration, you must allow GitLab to communicate with the Microsoft Graph API.
To configure Azure AD:
- In the Azure Portal, go to Microsoft Entra ID > App registrations > All applications, and select your GitLab SAML application.
- Under Essentials, the Application (client) ID and Directory (tenant) ID values are displayed. Copy these values, because you need them for the GitLab configuration.
- In the left navigation, select Certificates & secrets.
- On the Client secrets tab, select New client secret.
- In the Description text box, add a description.
- In the Expires dropdown list, set the expiration date for the credentials. If the secret expires, the GitLab integration will no longer work until the credentials are updated.
- To generate the credentials, select Add.
- Copy the Value of the credential. This value is displayed only once, and you need it for the GitLab configuration.
- In the left navigation, select API permissions.
- Select Microsoft Graph > Application permissions.
- Select the checkboxes GroupMember.Read.All and User.Read.All.
- Select Add permissions to save.
- Select Grant admin consent for
<application_name>
, then on the confirmation dialog select Yes. The Status column for both permissions should change to a green check with Granted for<application_name>
.
Configure GitLab
After you configure Azure AD, you must configure GitLab to communicate with Azure AD.
With this configuration, if a user signs in with SAML and Azure sends a group
claim in the response,
GitLab initiates a Group Sync job to call the Microsoft Graph API and retrieve the user’s group membership.
Then the GitLab group membership is updated according to SAML Group Links.
The following table lists the GitLab settings and the corresponding Azure AD fields for the configuration:
GitLab setting | Azure field |
---|---|
Tenant ID | Directory (tenant) ID |
Client ID | Application (client) ID |
Client Secret | Value (on Certificates & secrets page) |
To configure Azure AD for a GitLab.com group:
- On the left sidebar, select Search or go to and find your group. This group must be at the top level.
- Select Settings > SAML SSO.
- Configure SAML SSO for the group.
- In the Microsoft Azure integration section, select the Enable Microsoft Azure integration for this group checkbox. This section is only visible if SAML SSO is configured and enabled for the group.
- Enter the Tenant ID, Client ID, and Client secret obtained earlier when configuring Azure Active Directory in the Azure Portal.
- Optional. If using Azure AD for US Government or Azure AD China, enter the appropriate Login API endpoint and Graph API endpoint. The default values work for most organizations.
- Select Save changes.
Global SAML group memberships lock
- Offering: GitLab Self-Managed, GitLab Dedicated
You can enforce a global lock on SAML group memberships. This lock limits who can invite new members to subgroups where membership is synchronized with SAML Group Links.
When you lock group memberships:
- You cannot set a group or subgroup as a Code Owner. For more information, see Incompatibility with Global SAML group memberships lock.
- Only administrators can manage group members and change their access levels.
- Group members cannot:
- Share a project with other groups.
- Invite members to a project created in a group.
- Modify the membership of a top-level group configured for SAML Group Links synchronization.
Lock group memberships
Prerequisites:
- SAML SSO for GitLab Self-Managed must be configured.
To lock memberships to SAML Group Links synchronization:
- On the left sidebar, at the bottom, select Admin.
- Select Settings > General.
- Expand the Visibility and access controls section.
- Select the Lock memberships to SAML Group Links synchronization checkbox.
Docs
Edit this page to fix an error or add an improvement in a merge request.
Create an issue to suggest an improvement to this page.
Product
Create an issue if there's something you don't like about this feature.
Propose functionality by submitting a feature request.
Feature availability and product trials
View pricing to see all GitLab tiers and features, or to upgrade.
Try GitLab for free with access to all features for 30 days.
Get help
If you didn't find what you were looking for, search the docs.
If you want help with something specific and could use community support, post on the GitLab forum.
For problems setting up or using this feature (depending on your GitLab subscription).
Request support