Gitlab SSO Azure Ad Integration Guide

Author

Reads 318

Female Software Engineer Coding on Computer
Credit: pexels.com, Female Software Engineer Coding on Computer

To integrate GitLab SSO with Azure AD, you'll need to create an application registration in the Azure portal. This will provide you with a client ID and client secret that you'll use to configure GitLab.

Azure AD supports several authentication flows, including authorization code flow and client credentials flow. You'll choose the flow that best suits your needs.

To begin, navigate to the Azure portal and select Azure Active Directory. From there, click on App registrations and then New application.

Migrate to OpenID Connect Configuration

Migrating to OpenID Connect configuration is a requirement for GitLab instances using azure_oauth2 in versions 17.0 and later. This means you'll need to make some changes to your configuration.

The uid_field is a crucial setting that differs across providers. For example, omniauth-azure-oauth2 uses "sub" as the uid_field, while omniauth-azure-activedirectory-v2 uses "oid".

Here's a table to help you keep track of the uid_field settings for different providers:

To migrate from omniauth-azure-oauth2 to omniauth_openid_connect, you'll need to change the configuration. Similarly, to migrate from omniauth-azure-activedirectory-v2 to omniauth_openid_connect, you'll also need to change the configuration.

Register and Configure Azure App

Credit: youtube.com, Azure AD App Registration in 4 Simple Steps

To register and configure an Azure app, you'll need to sign in to the Azure portal and switch to the desired tenant, noting the tenant ID. You can then register an application and provide the necessary information.

Save the client ID and client secret, as the client secret is only displayed once. You can create a new application secret if required.

To enable Single Sign On (SSO) for your enterprise application, you'll need a user account in Azure Active Directory, which you can create for free if you don't already have one. You'll also need a role such as Global Administrator, Cloud Application Administrator, or Application Administrator to set up SSO.

Migrate to OpenID Connect

Migrating to OpenID Connect can seem daunting, but it's a necessary step for Azure App registration and configuration.

If you're using an instance of GitLab 17.0 or later, you'll need to migrate from the azure_oauth2 configuration to the Generic OpenID Connect configuration.

Credit: youtube.com, SonicWall - How to Configure OpenID Connect in Azure

The uid_field is a crucial setting when migrating to OpenID Connect, and it differs across providers.

Here's a breakdown of the uid_field settings for different providers:

To migrate from omniauth-azure-oauth2 to omniauth_openid_connect, or from omniauth-azure-activedirectory-v2 to omniauth_openid_connect, you'll need to change your configuration.

Register an Application

To register an application, you need to sign in to the Azure portal. This will give you access to the Azure Active Directory where you can register a new application.

You may have multiple Azure Active Directory tenants, so make sure to switch to the desired tenant. Note the tenant ID, as you'll need it later.

To register an application, follow these steps:

  1. Register an application and provide the following information:
  2. Save the client ID and client secret. The client secret is only displayed once.

You can create a new application secret if required. Remember that the client ID and client secret are terms associated with OAuth 2.0, and in some Microsoft documentation, they're named Application ID and Application Secret.

Setup Single Sign-On

To set up Single Sign-On (SSO) with Azure AD, you'll need to register an Azure application and get a client ID and secret key. This is done by signing in to the Azure portal, switching to the desired tenant, and registering an application with the required information.

Additional reading: Azure Ad App

Credit: youtube.com, Manage:Access - Minimal Access with SSO for Gitlab.com

You can create a free account in Azure Active Directory if you don't already have one. To set up SSO, you'll need a user account in Azure Active Directory and a role such as Global Administrator, Cloud Application Administrator, or Application Administrator.

The Azure Active Directory Admin Center is used to enable SSO for an enterprise application that you added to your Azure AD tenant. You'll need to configure the SAML identity provider, which involves setting up the Assertion consumer service URL, Identifier, and GitLab single sign-on URL.

To configure the SAML identity provider, follow these steps:

  1. Select Menu > Groups from the top bar and look for your group.
  2. Select Settings > SAML SSO from the left sidebar.
  3. Use the Assertion consumer service URL, Identifier, and GitLab single sign-on URL to configure your SAML identity provider.
  4. Set up the SAML response to contain a NameID that identifies each user individually.
  5. Configure the user attributes that are required, making sure to include the user's email address.
  6. While most SAML providers are set to have service provider started calls by default, in order to join existing GitLab accounts, make sure the app is set to have service provider initiated calls.

Once you've configured the identity provider, you can enable Microsoft OAuth in GitLab. This involves configuring the common settings to add azure_activedirectory_v2 or azure_oauth2 as a single sign-on provider, and adding the provider configuration with the client ID, client secret, and tenant ID.

Credit: youtube.com, GitLab Single Sign On (OAuth/OIDC SSO) | Login into Jira using GitLab | Jira GitLab SSO | Jira SSO

You can also optionally add the scope for OAuth 2.0 scopes parameter to the args section, with the default being openid profile email. After saving the configuration file, you'll need to reconfigure or restart GitLab, and then refresh the GitLab sign-in page to see the Microsoft icon below the sign-in form.

Configure Identity Provider

To configure your Identity Provider, start by selecting your group from the top bar and then navigating to the SAML SSO settings. You'll need to use the Assertion consumer service URL, Identifier, and GitLab single sign-on URL to configure your SAML identity provider.

You'll also need to set up the SAML response to contain a NameID that identifies each user individually, and configure the user attributes that are required, making sure to include the user's email address. This is crucial for a seamless SSO experience.

To ensure that users can join existing GitLab accounts, make sure the app is set to have service provider-initiated calls. This is a common gotcha that can be easily overlooked.

Credit: youtube.com, SCIM Provisioning on Azure Using SAML SSO for Groups Demo

Here's a quick checklist to help you configure your Identity Provider:

  • Select Menu > Groups from the top bar and look for your group.
  • Select Settings > SAML SSO from the left sidebar.
  • Use the Assertion consumer service URL, Identifier, and GitLab single sign-on URL to configure your SAML identity provider.
  • Set up the SAML response to contain a NameID that identifies each user individually.
  • Configure the user attributes that are required, making sure to include the user's email address.
  • Set the app to have service provider-initiated calls.

Rosemary Boyer

Writer

Rosemary Boyer is a skilled writer with a passion for crafting engaging and informative content. With a focus on technical and educational topics, she has established herself as a reliable voice in the industry. Her writing has been featured in a variety of publications, covering subjects such as CSS Precedence, where she breaks down complex concepts into clear and concise language.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.