Skip to content

Fix Docker: resolve permission denied and libsecret persistence failure#1977

Draft
g2vinay wants to merge 1 commit intomicrosoft:mainfrom
g2vinay:fix/docker-permission-and-libsecret
Draft

Fix Docker: resolve permission denied and libsecret persistence failure#1977
g2vinay wants to merge 1 commit intomicrosoft:mainfrom
g2vinay:fix/docker-permission-and-libsecret

Conversation

@g2vinay
Copy link
Contributor

@g2vinay g2vinay commented Mar 10, 2026

Fixes two issues affecting Docker users:

  1. Permission denied on ./azmcp — only the renamed server-binary was made executable; the original binary was not. Added it to the chmod so it can be invoked directly.

  2. Authentication fails with "Persistence check failed / libsecret not found" — the Alpine image was missing libsecret, causing MSAL's token-cache initialization to throw a hard exception that bypassed the entire credential chain — even when valid service principal credentials were set. Fixed by installing libsecret in the image and wrapping InteractiveBrowserCredential in SafeTokenCredential so any persistence failure falls through gracefully instead of crashing.

Also adds a Docker section to Authentication.md recommending AZURE_TOKEN_CREDENTIALS=prod for container deployments to skip interactive credentials entirely.

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.
@g2vinay g2vinay changed the title fix(docker): resolve permission denied and libsecret persistence failure Fix Docker: resolve permission denied and libsecret persistence failure Mar 10, 2026
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.

1 participant