|
31 | 31 |
|
32 | 32 | 1. **npm Authentication Issues for Remote Access** |
33 | 33 | If you encounter authentication errors: |
34 | | - - Ensure you are logged in to Azure DevOps using the `az` CLI: |
35 | | - |
36 | | - ```pwsh |
37 | | - az login |
38 | | - ``` |
39 | | -
|
40 | 34 | - Verify your npm configuration: |
41 | 35 |
|
42 | 36 | ```pwsh |
|
54 | 48 |
|
55 | 49 | ## Authentication Issues |
56 | 50 |
|
57 | | -### Multi-Tenant Authentication Problems |
| 51 | +### GitHub Codespaces |
| 52 | + |
| 53 | +Due to limitations of the environment default OAuth option is not available in Codespace. |
| 54 | +Make sure you authenticate via |
| 55 | + |
| 56 | +```sh |
| 57 | +az login |
| 58 | +``` |
| 59 | + |
| 60 | +in the terminal before using MCP tools. |
| 61 | + |
| 62 | +And in case there are authorization/access errors when using the tools please check the [Multi-Tenant Authentication Problems guide](#multi-tenant-authentication-problems-when-using-azcli) |
| 63 | + |
| 64 | +### OAuth |
| 65 | + |
| 66 | +Recent switch to OAuth flow is supposed to simplify authentication against ADO APIs and remove additional software dependency. |
| 67 | + |
| 68 | +It is however possible that strict tenant admin policies prevent users from successfully logging in using OAuth flow. In that case consider falling back to AZ CLI. |
| 69 | + |
| 70 | +#### Symptoms |
| 71 | + |
| 72 | +Upon ADO tool execution browser opens a tab/window and after login attempt an error text is displayed: |
| 73 | + |
| 74 | +``` |
| 75 | +Error occurred: ... |
| 76 | +``` |
| 77 | + |
| 78 | +#### Solution |
| 79 | + |
| 80 | +Try using Azure login context instead: |
| 81 | + |
| 82 | +1. Install [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest) and **log in**: |
| 83 | + |
| 84 | + ```sh |
| 85 | + az login |
| 86 | + ``` |
| 87 | + |
| 88 | +2. **Configure the MCP server** with the azcli authentication option by updating your `.vscode/mcp.json`. |
| 89 | + |
| 90 | + ```json |
| 91 | + { |
| 92 | + "inputs": [ |
| 93 | + { |
| 94 | + "id": "ado_org", |
| 95 | + "type": "promptString", |
| 96 | + "description": "Azure DevOps organization name (e.g. 'contoso')" |
| 97 | + } |
| 98 | + ], |
| 99 | + "servers": { |
| 100 | + "ado": { |
| 101 | + "type": "stdio", |
| 102 | + "command": "npx", |
| 103 | + "args": ["-y", "@azure-devops/mcp", "${input:ado_org}", "--authentication", "azcli"] |
| 104 | + } |
| 105 | + } |
| 106 | + } |
| 107 | + ``` |
| 108 | + |
| 109 | +3. **Restart VS Code** completely to ensure the MCP server picks up the new configuration. |
| 110 | + |
| 111 | +### Multi-Tenant Authentication Problems when using azcli |
58 | 112 |
|
59 | 113 | If you encounter authentication errors like `TF400813: The user 'xxx' is not authorized to access this resource`, you may be experiencing multi-tenant authentication issues. |
60 | 114 |
|
@@ -100,7 +154,7 @@ The MCP server may be authenticating with a different tenant than your Azure Dev |
100 | 154 | "ado": { |
101 | 155 | "type": "stdio", |
102 | 156 | "command": "npx", |
103 | | - "args": ["-y", "@azure-devops/mcp", "${input:ado_org}", "--tenant", "${input:ado_tenant}"] |
| 157 | + "args": ["-y", "@azure-devops/mcp", "${input:ado_org}", "--authentication", "azcli", "--tenant", "${input:ado_tenant}"] |
104 | 158 | } |
105 | 159 | } |
106 | 160 | } |
@@ -137,44 +191,3 @@ The MCP server may be authenticating with a different tenant than your Azure Dev |
137 | 191 | 4. **When prompted**, enter: |
138 | 192 | - Your Azure DevOps organization name |
139 | 193 | - The tenant ID from step 1 |
140 | | - |
141 | | -### Dev Container and WSL Authentication Issues |
142 | | - |
143 | | -If the tenant configuration solution above doesn't resolve your authentication issues, and you're working in a **Dev Container** or **WSL (Windows Subsystem for Linux)** environment, the root cause may be different. |
144 | | - |
145 | | -#### Dev Container/WSL Symptoms |
146 | | - |
147 | | -- Same authorization errors as above (`TF400813: The user 'xxx' is not authorized to access this resource`) |
148 | | -- Tenant ID configuration didn't resolve the issue |
149 | | -- You're using VS Code with Dev Containers or WSL |
150 | | -- MCP server is configured in User Settings (global) rather than workspace settings |
151 | | - |
152 | | -#### Dev Container/WSL Root Cause |
153 | | - |
154 | | -When MCP servers are configured in **User Settings** (global configuration), they inherit the environment context from the **host machine**, including `az login` authentication settings. In Dev Container or WSL scenarios, this means: |
155 | | - |
156 | | -- The MCP server uses the host machine's Azure authentication |
157 | | -- Any `az login` performed inside the Dev Container or WSL environment is ignored |
158 | | -- There may be a mismatch between the authentication context the MCP server expects and your development environment |
159 | | - |
160 | | -#### Dev Container/WSL Solution |
161 | | - |
162 | | -1. **Verify your MCP configuration location**: |
163 | | - - Check if your MCP server is configured in User Settings (global) vs Workspace Settings |
164 | | - - User Settings: Run `MCP: Open User Configuration` from Command Palette |
165 | | - - Workspace Settings: Check for `.vscode/mcp.json` in your project |
166 | | - |
167 | | -2. **For User Settings (Global) MCP configuration**: |
168 | | - - Ensure you are logged into Azure from the **host machine** (not inside the Dev Container/WSL) |
169 | | - - Run `az login` on the host Windows machine (outside of WSL/Dev Container) |
170 | | - - Do NOT run `az login` inside the Dev Container or WSL environment |
171 | | - - Restart VS Code completely |
172 | | - |
173 | | -3. **Alternative: Use Workspace Settings instead**: |
174 | | - - Move your MCP server configuration from User Settings to Workspace Settings |
175 | | - - Create/update `.vscode/mcp.json` in your project |
176 | | - - This allows the MCP server to use the authentication context from within the Dev Container/WSL environment |
177 | | - |
178 | | -4. **For Dev Containers specifically**: |
179 | | - - Consider configuring MCP servers directly in your `devcontainer.json` file using the `customizations.vscode.mcp` section |
180 | | - - This ensures the MCP server runs within the containerized environment with the correct context |
|
0 commit comments