PageRenderTime 41ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/doc/integration/azure.md

https://gitlab.com/bak1an/gitlab-ce
Markdown | 83 lines | 54 code | 29 blank | 0 comment | 0 complexity | 0f2f1cbe95163a8e1329c41499c00d8c MD5 | raw file
Possible License(s): CC-BY-3.0
  1. # Microsoft Azure OAuth2 OmniAuth Provider
  2. 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.
  3. 1. Sign in to the [Azure Management Portal](https://manage.windowsazure.com>).
  4. 1. Select "Active Directory" on the left and choose the directory you want to use to register GitLab.
  5. 1. Select "Applications" at the top bar and click the "Add" button the bottom.
  6. 1. Select "Add an application my organization is developing".
  7. 1. Provide the project information and click the "Next" button.
  8. - Name: 'GitLab' works just fine here.
  9. - Type: 'WEB APPLICATION AND/OR WEB API'
  10. 1. On the "App properties" page enter the needed URI's and click the "Complete" button.
  11. - SIGN-IN URL: Enter the URL of your GitLab installation (e.g 'https://gitlab.mycompany.com/')
  12. - APP ID URI: Enter the endpoint URL for Microsoft to use, just has to be unique (e.g 'https://mycompany.onmicrosoft.com/gitlab')
  13. 1. Select "Configure" in the top menu.
  14. 1. 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).
  15. 1. 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..
  16. 1. Note the "CLIENT ID" and the "CLIENT SECRET".
  17. 1. Select "View endpoints" from the bottom menu.
  18. 1. 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.
  19. 1. On your GitLab server, open the configuration file.
  20. For omnibus package:
  21. ```sh
  22. sudo editor /etc/gitlab/gitlab.rb
  23. ```
  24. For installations from source:
  25. ```sh
  26. cd /home/git/gitlab
  27. sudo -u git -H editor config/gitlab.yml
  28. ```
  29. 1. See [Initial OmniAuth Configuration](omniauth.md#initial-omniauth-configuration) for initial settings.
  30. 1. Add the provider configuration:
  31. For omnibus package:
  32. ```ruby
  33. gitlab_rails['omniauth_providers'] = [
  34. {
  35. "name" => "azure_oauth2",
  36. "args" => {
  37. "client_id" => "CLIENT ID",
  38. "client_secret" => "CLIENT SECRET",
  39. "tenant_id" => "TENANT ID",
  40. }
  41. }
  42. ]
  43. ```
  44. For installations from source:
  45. ```
  46. - { name: 'azure_oauth2',
  47. args: { client_id: "CLIENT ID",
  48. client_secret: "CLIENT SECRET",
  49. tenant_id: "TENANT ID" } }
  50. ```
  51. 1. Replace 'CLIENT ID', 'CLIENT SECRET' and 'TENANT ID' with the values you got above.
  52. 1. Save the configuration file.
  53. 1. Restart GitLab for the changes to take effect.
  54. 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 GitLab application. If everything goes well the user will be returned to GitLab and will be signed in.