Skip to content

Handle Browser Credential Failure in Chained Credential.#2076

Merged
g2vinay merged 2 commits intomicrosoft:mainfrom
g2vinay:g2vinay/fix/docker-permission-and-libsecret
Mar 17, 2026
Merged

Handle Browser Credential Failure in Chained Credential.#2076
g2vinay merged 2 commits intomicrosoft:mainfrom
g2vinay:g2vinay/fix/docker-permission-and-libsecret

Conversation

@g2vinay
Copy link
Copy Markdown
Contributor

@g2vinay g2vinay commented Mar 17, 2026

No description provided.

g2vinay and others added 2 commits March 9, 2026 18:36
Two issues affecting Docker users:

1. The azmcp binary in /mcp-server/ lacked execute permission because only
   the renamed server-binary was chmod'd. Any direct invocation of ./azmcp
   (custom entrypoints, workaround configs) hit 'permission denied'.
   Fix: chmod both server-binary and \.

2. InteractiveBrowserCredential's MSAL token-cache persistence requires
   libsecret, which was absent from the Alpine base image. This caused
   'Persistence check failed / libsecret-1.so.0 not found' errors even
   when valid service-principal credentials were supplied via env vars,
   because the MsalCachePersistenceException propagated as an unhandled
   exception rather than CredentialUnavailableException, killing the chain.
   Fixes:
   - Install libsecret in the Dockerfile so persistence works when a
     keyring daemon is available.
   - Wrap CreateBrowserCredential in SafeTokenCredential so any remaining
     persistence failure gracefully falls through the credential chain
     instead of surfacing as an unhandled AuthenticationFailedException.

Adds a Docker section to docs/Authentication.md explaining that
AZURE_TOKEN_CREDENTIALS=prod must be set when running in a container to
avoid interactive-credential fallback and the libsecret dependency.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates Azure MCP’s authentication flow to avoid hard failures when the InteractiveBrowserCredential fallback can’t initialize (common in headless/Docker environments), and records the fix in the server changelog.

Changes:

  • Wrap the InteractiveBrowserCredential fallback in SafeTokenCredential so non-CredentialUnavailableException failures don’t prematurely terminate the chained credential flow.
  • Add a changelog entry noting the fix for InteractiveBrowserCredential-related crashes.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
servers/Azure.Mcp.Server/changelog-entries/1773705083200.yaml Documents the bug fix in the server changelog entry format.
core/Microsoft.Mcp.Core/src/Services/Azure/Authentication/CustomChainedCredential.cs Ensures the browser fallback credential failures are normalized for proper chaining behavior.

@g2vinay g2vinay merged commit cb04596 into microsoft:main Mar 17, 2026
29 checks passed
@github-project-automation github-project-automation Bot moved this from Untriaged to Done in Azure MCP Server Mar 17, 2026
colbytimm pushed a commit to colbytimm/microsoft-mcp that referenced this pull request Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants