Sourcegraph DocsSourcegraph Docs
  • Code Intelligence

    • Cody
    • Code Search
  • Code Management

    • Batch Changes
    • Code Monitoring
    • Code Ownership
    • Code Insights
    • Notebooks
  • Platform

    • Sourcegraph Admin
    • Sourcegraph Cloud
    • Integrations
  • CLI & API

    • Sourcegraph CLI
    • Sourcegraph GraphQL API
    • Sourcegraph Stream API
  • Help & Support

    • SLAs & Premium Support
    • How to videos
    • Tutorials
    • Sourcegraph Accounts
    • Changelog
    • Releases
  1. Docs
  2. admin
  3. auth
  4. saml
  5. azure_ad

Configuring SAML with Microsoft Entra ID

1. Add an unlisted (non-gallery) application to your Microsoft Entra ID organization

  1. In Microsoft Entra ID, 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 "sourcegraph.example.com" with your Sourcegraph instance URL):
  • Identifier (Entity ID): https://sourcegraph.example.com/.auth/saml/metadata
  • Reply URL (Assertion Consumer Service URL): https://sourcegraph.example.com/.auth/saml/acs
  • 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:

JSON
{ // ... "externalURL": "https://sourcegraph.example.com", "auth.providers": [ { "type": "saml", "configID": "azure", "identityProviderMetadataURL": "https://login.microsoftonline.com/7d2a00ed-73e8-4920-bbfa-ef68effe2d1e/federationmetadata/2007-06/federationmetadata.xml?appid=eff20ae4-145b-4bd3-ff3f-21edab43fe99" } ] }

NOTE: Optional, but recommended: add automatic provisioning of users with SCIM.

On this page

  1. Configuring SAML with Microsoft Entra ID

    1. 1. Add an unlisted (non-gallery) application to your Microsoft Entra ID organization
    1. 2. Add the SAML auth provider to Sourcegraph site config

Edit this page on GitHub
Questions? Give us feedback