@@ -34,7 +34,7 @@ Configures Codespace to work with an external Git repository
3434
3535- ` ms-codespaces-tools.ado-codespaces-auth `
3636
37- This feature standardizes and simplifies the proces of setting up a Codespace
37+ This feature standardizes and simplifies the process of setting up a Codespace
3838to work with an external repository -- meaning a Git repository other than
3939the one that defines your Codespace. This is being primarily developed to
4040support Azure DevOps repositories but it ought to work with any Git repository.
@@ -51,6 +51,23 @@ process.
5151It is always possible to provide a token via the ` userSecret ` and this is what works with
5252other Git hosting providers.
5353
54+ #### Microsoft Entra ID Tenant Configuration
55+
56+ The authentication to Azure DevOps happens on the default tenant. If the user is present on
57+ multiple tenants, and the Azure DevOps organization for the repository belongs to a specific
58+ one, the repository operations may fail (unauthorized). You can configure the tenant for
59+ the authentication by providing it as setting to the the underlying extension in your devcontainer.json:
60+
61+ ``` json
62+ "customizations" : {
63+ "vscode" :{
64+ "settings" : {
65+ "adoCodespacesAuth.tenantID" : " <YOUR_ENTRA_ID_TENANT_ID>" ,
66+ }
67+ }
68+ }
69+ ```
70+
5471## Example Usage Scenarios
5572
5673Here is a minimal example that clones an Azure DevOps repository. This would also require
@@ -90,6 +107,27 @@ If a user configures a Codespaces User Secret named `ADO_SECRET` and assigns thi
90107Codespace, then the value of that secret will be used as a PAT for authentication. If the secret
91108is not defined by the user it will fallback to the browser login.
92109
110+ ### Interactive authentication only (avoids PAT token)
111+
112+ The advantage of using a PAT token is the ability to clone the repository during the devContainer creation
113+ (onCreateCommand). You can avoid the need to configure a secret by requiring the authentication once the
114+ Codespace loads. This means the repository will be cloned only after the Codespaces UI initializes completely:
115+
116+ ``` json
117+ {
118+ "image" : " mcr.microsoft.com/devcontainers/universal:ubuntu" ,
119+ "features" : {
120+ "ghcr.io/microsoft/codespace-features/external-repository:latest" : {
121+ "cloneUrl" : " https://dev.azure.com/contoso/_git/reposname" ,
122+ "folder" : " /workspaces/ado-repos"
123+ }
124+ },
125+ "workspaceFolder" : " /workspaces/ado-repos" ,
126+ "initializeCommand" : " mkdir -p ${localWorkspaceFolder}/../ado-repos" ,
127+ "postStartCommand" : " external-git clone && external-git config"
128+ }
129+ ```
130+
93131## Multiple Repository Support
94132
95133As of version 3, you can clone multiple repositories by separating the URL's with a comma. In this
0 commit comments