Configuring SAML with Azure Active Directory (Azure AD)

  1. In Azure AD, create an unlisted (non-gallery) application following the official documentation.
  2. Once the application is created, follow these instructions to enable SAML SSO. Use these configuration values (replacing "" with your Sourcegraph instance URL):
  • Identifier (Entity ID):
  • Reply URL (Assertion Consumer Service URL):
  • Sign-on URL, Relay State, and Logout URL can be left empty.
  • User Attributes & Claims: Add the following attributes.
    emailaddress: user.mail (required)
    name: user.userprincipalname (optional)
    login: user.userprincipalname (optional)
  • Name ID: email
  • You can leave the other configuration values set to their defaults.
  1. Record the value of the "App Federation Metadata Url". You'll need this in the next section.

2. Add the SAML auth provider to Sourcegraph site config

Add a SAML auth provider with identityProviderMetadataURL set to the "App Federation Metadata Url" you recorded in the previous section. Here is an example of what your site configuration should look like:

 // ...
 "externalURL": "",
 "auth.providers": [
     "type": "saml",
     "configID": "azure",
     "identityProviderMetadataURL": ""