Skip to content

Fix functional issues and update dependencies#3001

Open
g2vinay wants to merge 3 commits into
microsoft:mainfrom
g2vinay:fix-p2-issues-june
Open

Fix functional issues and update dependencies#3001
g2vinay wants to merge 3 commits into
microsoft:mainfrom
g2vinay:fix-p2-issues-june

Conversation

@g2vinay

@g2vinay g2vinay commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Addresses following issues:

#2632 / #2633 — VS Code extension dependency updates

  • Updated @microsoft/vscode-azext-utils from ~2 (2.6.8) to ~4 (4.1.1) across all three VS Code extensions (Azure.Mcp.Server, Fabric.Mcp.Server, Template.Mcp.Server)
  • Updated @vscode/vsce from 3.7.1 to 3.9.2 across the same extensions
  • Verified: tsc compile, webpack build, and eng/scripts/Build-Local.ps1 -VerifyNpx all pass

#399 — Silent fallback on unrecognized AZURE_TOKEN_CREDENTIALS value

  • The default: case in CreateDefaultCredential previously fell back to the full default credential chain with no indication the supplied value was unrecognized (e.g. a typo like AzuerCliCredential)
  • Now emits LogWarning listing the recognized values before falling back
  • Added AcceptedTokenCredentialValues static array as single source of truth for the warning message
  • Added UnknownCredentialValue_LogsWarning_AndFallsBackToDefaultChain test

#398 — Thread-safety race in CustomChainedCredential lazy initialization

  • ??= is not atomic in C#; concurrent GetToken/GetTokenAsync calls before initialization could construct duplicate credential chains with diverged MSAL token caches
  • Replaced TokenCredential? _credential + ??= with Lazy<TokenCredential> (ExecutionAndPublication) for guaranteed single initialization under concurrent access
  • Added GetToken_ConcurrentCalls_InitializesCredentialExactlyOnce test

Closes #2632, #2633, #399, #398

g2vinay added 2 commits July 6, 2026 18:30
Upgrades @microsoft/vscode-azext-utils from ~2 (locked at 2.6.8) to ~4
(locked at 4.1.1) across all three VS Code extensions:
- servers/Azure.Mcp.Server/vscode
- servers/Fabric.Mcp.Server/vscode
- servers/Template.Mcp.Server/vscode

Compile, build, and eng/scripts/Build-Local.ps1 -VerifyNpx all pass.

Closes microsoft#2632
Closes microsoft#2633
The switch in CreateDefaultCredential had a silent default: case that
fell back to the full default credential chain with no indication that
the supplied value was unrecognized. A typo such as
AZURE_TOKEN_CREDENTIALS=AzuerCliCredential would silently use the
default chain, making the misconfiguration invisible.

Fix: emit a LogWarning in the default: case before falling back,
listing the recognized values so the user can identify and correct
the typo immediately.

Changes:
- Add AcceptedTokenCredentialValues static array (single source of
  truth for the warning message).
- Add optional ILogger parameter to CreateDefaultCredential and thread
  it through from CreateCredential, which already held the logger.
- Emit LogWarning in default: with the unrecognized value and the list
  of accepted values.
- Add UnknownCredentialValue_LogsWarning_AndFallsBackToDefaultChain
  test with CapturingLoggerProvider/CapturingLogger helpers.

Closes microsoft#399
@github-project-automation github-project-automation Bot moved this to Untriaged in Azure MCP Server Jul 7, 2026
@g2vinay g2vinay changed the title Fix p2 issues june Fix functional issues and update dependencies Jul 7, 2026
@g2vinay g2vinay marked this pull request as ready for review July 7, 2026 06:26
@g2vinay g2vinay requested review from a team as code owners July 7, 2026 06:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates VS Code extension dependencies across the Azure/Fabric/Template MCP servers and fixes two functional issues in Azure authentication credential selection: (1) warning on unknown AZURE_TOKEN_CREDENTIALS values instead of silently falling back, and (2) thread-safe, single-initialization of the credential chain under concurrent access, with added tests and changelog entries.

Changes:

  • Bumped @microsoft/vscode-azext-utils and @vscode/vsce versions across all three VS Code extensions (and updated lockfiles accordingly).
  • Updated CustomChainedCredential to use Lazy<TokenCredential> and to log warnings for unrecognized AZURE_TOKEN_CREDENTIALS values.
  • Added unit tests and changelog-entry YAMLs documenting these updates/fixes.

Reviewed changes

Copilot reviewed 9 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
servers/Template.Mcp.Server/vscode/package.json Update VS Code extension dependency versions.
servers/Template.Mcp.Server/vscode/package-lock.json Lockfile updates for the dependency bumps.
servers/Fabric.Mcp.Server/vscode/package.json Update VS Code extension dependency versions (plus JSON formatting change).
servers/Fabric.Mcp.Server/vscode/package-lock.json Lockfile updates for the dependency bumps.
servers/Fabric.Mcp.Server/changelog-entries/1783387640737.yaml Changelog entry for Fabric VS Code dependency updates.
servers/Azure.Mcp.Server/vscode/package.json Update VS Code extension dependency versions.
servers/Azure.Mcp.Server/vscode/package-lock.json Lockfile updates for the dependency bumps.
servers/Azure.Mcp.Server/changelog-entries/1783400773627.yaml Changelog entry for CustomChainedCredential thread-safety fix.
servers/Azure.Mcp.Server/changelog-entries/1783387640512.yaml Changelog entry for warning on unrecognized AZURE_TOKEN_CREDENTIALS.
servers/Azure.Mcp.Server/changelog-entries/1783387640306.yaml Changelog entry for Azure VS Code dependency updates.
core/Microsoft.Mcp.Core/src/Services/Azure/Authentication/CustomChainedCredential.cs Implement Lazy<T> initialization + add warning for unknown env var values.
core/Azure.Mcp.Core/tests/Azure.Mcp.Core.Tests/Services/Azure/Authentication/CustomChainedCredentialTests.cs Add tests for warning behavior and concurrent initialization behavior.
Files not reviewed (3)
  • servers/Azure.Mcp.Server/vscode/package-lock.json: Generated file
  • servers/Fabric.Mcp.Server/vscode/package-lock.json: Generated file
  • servers/Template.Mcp.Server/vscode/package-lock.json: Generated file

@g2vinay g2vinay force-pushed the fix-p2-issues-june branch from 338e32f to 9cca07d Compare July 7, 2026 06:52
…zation

The ??= compound assignment is not atomic in C#. Under concurrent
GetToken / GetTokenAsync calls before the credential chain was
initialized (e.g. parallel tool calls on server startup in HTTP mode),
two threads could both observe _credential == null, construct separate
ChainedTokenCredential instances, and have one silently discarded. The
two chains may hold diverged MSAL token cache handles, causing
intermittent authentication failures.

Fix: replace the nullable field + ??= pattern with Lazy<TokenCredential>
using LazyThreadSafetyMode.ExecutionAndPublication, which provides
guaranteed single initialization under concurrent access with no
manual locking required.

Also adds GetToken_ConcurrentCalls_InitializesCredentialExactlyOnce
test to verify the Lazy<T>.IsValueCreated post-concurrent access.

Closes microsoft#398
@g2vinay g2vinay force-pushed the fix-p2-issues-june branch from 9cca07d to 0684f6f Compare July 7, 2026 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

Update @microsoft/vscode-azext-utils from v2 to v4 in VS Code extensions

3 participants