Skip to content

[FEATURE] Fall back to native Git credential helper for Azure DevOps authentication #3008

Closed

Description

@bunnu

Is your feature request related to a problem? Please describe.

Azure DevOps Services dependencies currently require either ADO_APM_PAT or an active Azure CLI session (az login). When neither is available, APM does not fall back to the native Git credential helper, even when the same repository can be accessed successfully with Git itself:

git clone https://dev.azure.com/org/project/_git/repo

This is inconvenient for users who already authenticate to Azure DevOps through Git Credential Manager or another configured Git credential helper. It also makes ADO behave differently from other supported Git hosts where APM can delegate authentication to Git.

Describe the solution you'd like

When installing a package from Azure DevOps Services (dev.azure.com or a supported *.visualstudio.com URL), APM should use the native Git credential helper as a fallback when:

  1. ADO_APM_PAT is not set; and
  2. Azure CLI authentication is unavailable, not installed, or the user is not signed in.

The fallback should invoke Git using the user's existing credential-helper configuration, without requiring APM-specific environment variables or embedding credentials in repository URLs. The behavior should be equivalent to a direct git clone or git ls-remote against the same repository.

The intended authentication order would be:

  1. ADO_APM_PAT;
  2. Azure CLI bearer authentication from az login;
  3. native Git credential helper;
  4. an actionable authentication error if all methods fail.

The implementation should remain non-interactive in APM's subprocesses, preserve current credential redaction and isolation guarantees, and avoid changing Azure DevOps Server's existing PAT-only behavior unless explicitly intended. Tests should cover helper-based HTTPS authentication, unavailable az, PAT and bearer precedence, and failure diagnostics.

Describe alternatives you've considered

  • Continue requiring ADO_APM_PAT, which duplicates credentials that users may already have stored in Git Credential Manager.
  • Require users to run az login, which is not always available in minimal environments, containers, or setups where Git Credential Manager is the established authentication path.
  • Use SSH URLs and SSH keys instead of HTTPS, which changes the dependency URL and is not always available for Azure DevOps users.

Additional context

Related authentication behavior is documented in Azure DevOps authentication.

I would be happy to help with reproduction, design feedback, or testing.

Activity

  1. added
    type/feature
    on Sep 17, 2026
  2. sergio-sisternes-epam commented on Sep 17, 2026

    @sergio-sisternes-epam
    Contributor

    Thanks for a clear, well-bounded request. You already did the right
    first step: opened an issue instead of a PR.

    Today Azure DevOps Services auth is ADO_APM_PAT, then az login
    bearer, then an error. GitHub-class and GitLab-class hosts already
    fall back to the native Git credential helper; ADO Git paths
    explicitly do not
    (https://microsoft.github.io/apm/getting-started/authentication/).
    If git clone https://dev.azure.com/... works and apm install
    does not, that is a real inconsistency.

    Advisory recommendation: needs-design, not acceptance. The direction
    fits APM (same Git credentials Git itself would use; Server stays
    PAT-only unless we say otherwise). Before code, please freeze:

    1. Git transport only (clone / ls-remote) vs also marketplace
      REST and ADO validation preflight, which currently skip helpers.
    2. Non-interactive helper rules: no GUI prompt, existing timeout,
      fail closed with an error that names PAT, az login, and the
      helper.
    3. Confirm Azure DevOps Server remains PAT-only.

    This comment is not scope approval. Please wait for a maintainer
    decision before opening a PR. A short note that git clone succeeds
    and apm install fails with neither ADO_APM_PAT nor az is
    welcome if you have one.


    Generated by autopilot-issue-triage-worker. This comment is AI-generated and may contain errors.

  3. added
    triage/recommended
    status/deferred
    on Sep 17, 2026
  4. danielmeppiel commented on Oct 15, 2026

    @danielmeppiel
    Collaborator

    Thanks for the report and the offer to help test, Benjamin (@bunnu). Closing this request as completed by #2610, merged on October 14.

    The Git credential-helper fallback is now in main: APM preserves PAT and available Azure CLI bearer precedence, then uses repository-scoped helper credentials after a recognized authentication failure. This is controlled credential resolution, not unrestricted use of ambient helpers in every subprocess, and credentials are not embedded in repository URLs.

    Release limitation: the latest stable release is still v0.33.0, published October 2. It does not contain #2610. This closure records completion in main; it does not mean that upgrading to today's latest release provides the fix, and it does not promise a release version or date.

    This supersedes the earlier needs-design advisory for the helper mechanism. Current authentication documentation also describes helper support for Azure DevOps Server, so the report's old Server-PAT-only premise is no longer current. No reversal of that behavior or additional implementation is requested here.

    The exact helper-only environment described in this report (no PAT, no usable Azure CLI session, and cached Git credentials) was not freshly reproduced as part of this disposition. Your testing offer remains useful: if the problem persists on a version containing #2610, please follow up with the APM version and a redacted failure description, without credentials.

    This explanation was drafted and posted with AI assistance after my explicit confirmation to close the issue as completed with the release limitation disclosed.

  5. removed
    status/deferred
    on Oct 15, 2026
  6. bunnu commented on Oct 15, 2026

    @bunnu
    Author

    Thank you for implementing the native Git credential helper fallback. I appreciate the effort — this will make using APM with ADO much smoother for users who already authenticate via Git Credential Manager. I’m looking forward to the next release.

  7. bunnu commented on Nov 3, 2026

    @bunnu
    Author

    Hi,

    Unfortunately the git credential helper still isn't being used when trying to install an app package from Azure Devops. In my understanding #2610 only implements git credentials helper fallback for marketplace fetches and policy discovery.

    Tested with version 0.35.0

    apm install --no-policy
    
    [>] Installing dependencies from apm.yml...
    [>] Resolving <ORG>/<PROJECT>/<REPO>...
    [!] Policy enforcement disabled by --no-policy for this invocation. This does NOT bypass apm audit --ci. CI will still fail
    the PR for the same policy violation.
    [i] Targets: <TARGET> (source: apm.yml)
    [x] 1 package failed:
    +- <ORG>/<PROJECT>/<REPO> -- Failed to download dependency
    <ORG>/<PROJECT>/<REPO>: Failed to clone repository <ORG>/<PROJECT>/<REPO> via
    plain HTTPS. To allow cross-protocol fallback (not recommended), pass --allow-protocol-fallback, set
    APM_ALLOW_PROTOCOL_FALLBACK=1, or run: apm config set allow-protocol-fallback true
    Azure DevOps requires authentication. You have two options:
    Sign in with Azure CLI (recommended for Entra ID users):
    az login
    apm install # retry -- no env var needed
    Use a Personal Access Token:
    export ADO_APM_PAT=your_token
    Docs: https://microsoft.github.io/apm/getting-started/authentication/#azure-devops Last error: Cloning into
    '/workspace/<REPO>/apm_modules/.apm-resolution-staging/1e32fd4e5d91/replacements/1cb0492fafc5979d'...
    fatal: Authentication failed for 'https://dev.azure.com/<ORG>/<PROJECT>/_git/<REPO>/'
    [x] Installation failed with 1 error(s) in 1.6s. No install transaction changes were committed.
    
  8. bunnu commented on Nov 16, 2026

    @bunnu
    Author

    Hi Daniel Meppiel (@danielmeppiel)

    As mentioned in my last comment, apm install still fails to authenticate against Azure DevOps when neither ADO_APM_PAT nor an active Azure CLI session is available, even though Git Credential Manager has valid cached credentials.

    My understanding is that #2610 implements the Git credential helper fallback for marketplace fetches and policy discovery, but the fallback is still missing from the actual Git clone operation used when installing app packages.

    Since this was the core requirement of the original feature request, could you please reopen this issue and reconsider it as not yet fully resolved?

    I appreciate the work already done, but closing the issue as completed seems premature while the primary use case remains broken.

    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage/recommendedtype/feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions