Skip to content

Commit 74ec201

Browse files
liguorimarkphip
andauthored
Document usage of TenantID and Clone without PAT (#49)
--------- Co-authored-by: Mark Phippard <markphip@gmail.com>
1 parent 306016b commit 74ec201

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

src/external-repository/NOTES.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
This feature standardizes and simplifies the proces of setting up a Codespace
1+
This feature standardizes and simplifies the process of setting up a Codespace
22
to work with an external repository -- meaning a Git repository other than
33
the one that defines your Codespace. This is being primarily developed to
44
support Azure DevOps repositories but it ought to work with any Git repository.
@@ -15,6 +15,23 @@ process.
1515
It is always possible to provide a token via the `userSecret` and this is what works with
1616
other Git hosting providers.
1717

18+
#### Microsoft Entra ID Tenant Configuration
19+
20+
The authentication to Azure DevOps happens on the default tenant. If the user is present on
21+
multiple tenants, and the Azure DevOps organization for the repository belongs to a specific
22+
one, the repository operations may fail (unauthorized). You can configure the tenant for
23+
the authentication by providing it as setting to the the underlying extension in your devcontainer.json:
24+
25+
```json
26+
"customizations": {
27+
"vscode":{
28+
"settings": {
29+
"adoCodespacesAuth.tenantID": "<YOUR_ENTRA_ID_TENANT_ID>",
30+
}
31+
}
32+
}
33+
```
34+
1835
## Example Usage Scenarios
1936

2037
Here is a minimal example that clones an Azure DevOps repository. This would also require
@@ -54,6 +71,27 @@ If a user configures a Codespaces User Secret named `ADO_SECRET` and assigns thi
5471
Codespace, then the value of that secret will be used as a PAT for authentication. If the secret
5572
is not defined by the user it will fallback to the browser login.
5673

74+
### Interactive authentication only (avoids PAT token)
75+
76+
The advantage of using a PAT token is the ability to clone the repository during the devContainer creation
77+
(onCreateCommand). You can avoid the need to configure a secret by requiring the authentication once the
78+
Codespace loads. This means the repository will be cloned only after the Codespaces UI initializes completely:
79+
80+
```json
81+
{
82+
"image": "mcr.microsoft.com/devcontainers/universal:ubuntu",
83+
"features": {
84+
"ghcr.io/microsoft/codespace-features/external-repository:latest": {
85+
"cloneUrl": "https://dev.azure.com/contoso/_git/reposname",
86+
"folder": "/workspaces/ado-repos"
87+
}
88+
},
89+
"workspaceFolder": "/workspaces/ado-repos",
90+
"initializeCommand": "mkdir -p ${localWorkspaceFolder}/../ado-repos",
91+
"postStartCommand": "external-git clone && external-git config"
92+
}
93+
```
94+
5795
## Multiple Repository Support
5896

5997
As of version 3, you can clone multiple repositories by separating the URL's with a comma. In this

0 commit comments

Comments
 (0)