VM Creation
DNS Name setting
Click the virtual machine that you just created earlier, select the Not Configured link next to the DNS name label.
GitLab CE Installation
Connect your VM and write the command:
sudo apt-get update
sudo apt-get install -y curl openssh-server ca-certificates tzdata perl
sudo apt-get install -y postfix
# Select Internet Site and press enter. Use your server's external DNS for 'mail name' and press enter
# Add the GitLab package repository
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo EXTERNAL_URL="https://gitlab-seanlim.westus3.cloudapp.azure.com" apt-get install gitlab-ce
Single Sign-on
- navigate to Azure Active Directory > App registrations > New Registration
- Select New Registration o Name: GitLabCE
- Supported Account Types: Accounts in this organizational directory only (the default)
- Redirect URI Web – https:///users/auth/azure_oauth2/callback
2. Select Certificates & secrets on the left side menu and Add a New client secret
You need the following from the details of your new registration:
- Application (client) ID
- Directory (tenant) ID
- Client_secret
3. SSH into your GitLabCE VM and Open /etc/gitlab/gitlab.rb as root. follow like this:
# OAuth Config
gitlab_rails['omniauth_enabled'] = true
gitlab_rails['omniauth_allow_single_sign_on'] = ['azure_oauth2']
gitlab_rails['omniauth_sync_email_from_provider'] = 'azure_oauth2'
gitlab_rails['omniauth_sync_profile_from_provider'] = ['azure_oauth2']
gitlab_rails['omniauth_sync_profile_attributes'] = ['name','email']
gitlab_rails['omniauth_block_auto_created_users'] = false
gitlab_rails['omniauth_auto_link_ldap_user'] = true
gitlab_rails['omniauth_external_providers'] = ['azure_oauth2']
gitlab_rails['omniauth_providers'] = [
{
"name" => "azure_oauth2",
"args" => {
"client_id" => "Client_ID",
"client_secret" => "Client_Secret",
"tenant_id" => "Tenant_ID",
}
}
]
Run the following command as root on the Gitlab server:
gitlab-ctl reconfigure
When you go to your GitLab application, it should now allow you to login with Oauth.
Login as root, you can see your password using this command:
sudo cat /etc/gitlab/initial_root_password
Create a group called Prototypes and set the visibility Internal. Then, click the setting button
Add users to group (Give owner privilege)
Sign Out and login to GitLab using Oauth. Then go to your group and select New project.
Create blank project -> Give a project name -> select Internal visibility -> Create project
Done!!
Wow that was odd. I just wrote an incredibly long comment but after I clicked submit my comment didn’t appear. Grrrr… well I’m not writing all that over again. Regardless, just wanted to say fantastic blog!