Skip to content

Commit 3708737

Browse files
authored
azure-devops: Adjust docs to cover new Entra OAuth apps (#1149)
See sourcegraph/sourcegraph#5504 for more details, the previous approach has been deprecated by Microsoft and no longer works. Closes SRC-1300. Test plan: Ran through this process locally and ended up with working perms syncing.
1 parent 0b99271 commit 3708737

File tree

1 file changed

+18
-22
lines changed

1 file changed

+18
-22
lines changed

docs/admin/config/authorization_and_authentication.mdx

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -118,39 +118,35 @@ We support authentication through OAuth for Bitbucket Server / Bitbucket Data Ce
118118

119119
We support authentication through OAuth for [Azure DevOps Services (dev.azure.com)](https://dev.azure.com) and it is also a prerequisite for [permissions syncing](/admin/permissions/).
120120

121-
#### Register a new OAuth application
121+
#### Register a new Entra OAuth application
122122

123-
[Create a new Azure DevOps OAuth application](https://app.vsaex.visualstudio.com/app/register) and follow the instructions below:
123+
[Create a new Entra OAuth application](https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/CreateApplicationBlade/quickStartType~/null/isMSAApp~/false) and follow the instructions below:
124124

125-
1. In the `Application website` field set the URL of your Sourcegraph instance, for example if the instance is https://sourcegraph.com, then use `https://sourcegraph.com` as the value of this field
126-
2. Similarly, set the `Authorization callback URL` field to `https://sourcegraph.com/.auth/azuredevops/callback` if your Sourcegraph instance URL is https://sourcegraph.com
127-
3. Add the following scopes:
128-
- `User profile (read)`
129-
- `Identity (read)`
130-
- `Code (read)`
131-
- `Project and team (read)`
125+
1. In the `Name` field pick a descriptive name for this connection
126+
2. For `Supported account types` select `Accounts in this organizational directory only`
127+
3. For `Redirect URI` pick `Web`(!) for the type and set the URL field to `https://<myinstance.sourcegraph.com>/.auth/azuredevops/callback` if your Sourcegraph instance URL is https://myinstance.sourcegraph.com
128+
4. Click **Register**
129+
5. Now go to the [Microsoft Entra admin center](https://entra.microsoft.com/) as at least an **Application Developer**.
130+
6. Go to **App registrations** and select the one you just created.
131+
7. Go to **Manage > Certificates & secrets** and generate a new client secret. Keep the secret value.
132+
8. Go to **Manage > API Permissions** and click **+ Add a permission**. Select Azure DevOps, then `vso.code`, `vso.identity`, and `vso.project`. Confirm with **Add permissions**.
133+
9. Go back to **Overview** from the sidebar. Now find the **Endpoints** button at the top center of the page, and take note of the value for **Authority URL (Accounts in this organizational directory only)** (which will look something like _https://login.microsoftonline.com/00000002-0000-0000-c000-000000000000_)
134+
10. The final value we need to get is the **Application (client) ID** from the **Overview** page. Take note of this UUID as well.
132135

133136
#### Configuring Sourcegraph auth.providers
134137

135-
Before you add the configuration please ensure that:
136-
137-
1. The value of `App ID` from your OAuth application is set as the value of the `clientID` field in the config
138-
2. The value of `Client Secret` (and not the `App secret`) from your OAuth application is set as the value of the `clientSecret` field
139-
3. The value of `apiScope` string is a comma separated string and reflects the scopes from your OAuth application accurately
140-
4. The `type` field has no typos and is **exactly** the same as the example below
141-
142-
Add the following to the `auth.providers` key in the site config:
138+
With all the values acquired above, you can now add the following to the `auth.providers` key in the site config:
143139

144140
```json
145141
{
146142
"auth.providers": [
147143
// Other auth providers may also be here.
148144
{
149-
"type": "azureDevOps",
145+
"type": "azureDevOps", // Casing is important!
150146
"displayName": "Azure DevOps",
151-
"clientID": "replace-with-app-id-of-your-oauth-application",
152-
"clientSecret": "replace-with-client-secret-of-your-oauth-application",
153-
"apiScope": "vso.code,vso.identity,vso.project"
147+
"url": "<Authority URL (Accounts in this organizational directory only)>",
148+
"clientID": "<Application (client) ID>",
149+
"clientSecret": "<Client secret>"
154150
}
155151
]
156152
}
@@ -181,9 +177,9 @@ The final and complete `auth.providers` configuration may look like this:
181177
{
182178
"type": "azureDevOps",
183179
"displayName": "Azure DevOps",
180+
"url": "https://login.microsoftonline.com/00000002-0000-0000-c000-000000000000",
184181
"clientID": "your-client-id-here",
185182
"clientSecret": "a-strong-client-secret-here",
186-
"apiScope": "vso.code,vso.identity,vso.project",
187183
"allowOrgs": ["your-org-1", "your-org-2"],
188184
"allowSignup": false
189185
}

0 commit comments

Comments
 (0)