To enable the Microsoft Azure OAuth2 OmniAuth provider you must register your application with Azure. Azure will generate a client ID and secret key for you to use.
Sign in to the Azure Management Portal.
Select "Active Directory" on the left and choose the directory you want to use to register GitSwarm.
Select "Applications" at the top bar and click the "Add" button the bottom.
Select "Add an application my organization is developing".
Select "Configure" in the top menu.
Add a "Reply URL" pointing to the Azure OAuth callback of your GitLab installation (e.g. https://gitlab.mycompany.com/users/auth/azure_oauth2/callback).
Create a "Client secret" by selecting a duration, the secret will be generated as soon as you click the "Save" button in the bottom menu..
Note the "CLIENT ID" and the "CLIENT SECRET".
Select "View endpoints" from the bottom menu.
You will see lots of endpoint URLs in the form 'https://login.microsoftonline.com/TENANT ID/...', note down the TENANT ID part of one of those endpoints.
On your GitSwarm server, open the configuration file.
For package installation:
sudo editor /etc/gitswarm/gitswarm.rb
For source installations:
cd /home/git/gitlab
sudo -u git -H editor config/gitlab.yml
See Initial OmniAuth Configuration for initial settings.
Add the provider configuration:
For package installation:
gitlab_rails['omniauth_providers'] = [
{
"name" => "azure_oauth2",
"args" => {
"client_id" => "CLIENT ID",
"client_secret" => "CLIENT SECRET",
"tenant_id" => "TENANT ID",
}
}
]
For source installations:
- { name: 'azure_oauth2',
args: { client_id: "CLIENT ID",
client_secret: "CLIENT SECRET",
tenant_id: "TENANT ID" } }
Replace 'CLIENT ID', 'CLIENT SECRET' and 'TENANT ID' with the values you got above.
Save the configuration file.
Restart GitSwarm for the changes to take effect.
On the sign in page there should now be a Microsoft icon below the regular sign in form. Click the icon to begin the authentication process. Microsoft will ask the user to sign in and authorize the GitSwarm application. If everything goes well the user will be returned to GitSwarm and will be signed in.