Skip to content

Support Azure CLI v2.69.0+ managed identity authentication parameter change - #26

Draft
Jury1981 with Copilot wants to merge 1 commit into
masterfrom
copilot/update-login-authentication-another-one
Draft

Support Azure CLI v2.69.0+ managed identity authentication parameter change#26
Jury1981 with Copilot wants to merge 1 commit into
masterfrom
copilot/update-login-authentication-another-one

Conversation

Copilot AI commented Feb 4, 2026

Copy link
Copy Markdown

Azure CLI v2.69.0 replaced --username with --client-id for user-assigned managed identity authentication (azure-cli#30525). Without version-aware parameter selection, the action breaks on newer CLI versions.

Changes

  • Version detection: Parse Azure CLI version on initialization, extract minor version number with fallback handling
  • Conditional parameter selection in loginWithUserAssignedIdentity():
    • CLI < 2.69.0 → --username
    • CLI ≥ 2.69.0 → --client-id
  • Test coverage: Version boundary tests (2.68.0, 2.69.0, 2.70.0), parse failure scenarios, edge cases

Implementation

async loginWithUserAssignedIdentity(args: string[]) {
    let azcliMinorVersion = 0;
    try {
        azcliMinorVersion = parseInt(this.azVersion.split('.')[1], 10);
        if (isNaN(azcliMinorVersion)) {
            core.warning("Failed to parse the minor version of Azure CLI. Assuming the version is less than 2.69.0");
            azcliMinorVersion = 0;
        }
    }
    catch (error) {
        core.warning("Failed to parse the minor version of Azure CLI. Assuming the version is less than 2.69.0");
    }
    
    if (azcliMinorVersion < 69) {
        args.push("--username", this.loginConfig.servicePrincipalId);
    }
    else {
        args.push("--client-id", this.loginConfig.servicePrincipalId);
    }
    await this.callCliLogin(args, 'user-assigned managed identity');
}

Maintains backward compatibility while supporting the new parameter format.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/Jury1981/login/commits/68fbe12def5ad0b157537954abaa94132dc1060acda0deccea7d7c152389c82d964d036baf9e1b2a
    • Triggering command: /usr/bin/curl curl -s REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Reference: 68fbe12def5ad0b157537954abaa94132dc1060acda0deccea7d7c152389c82d964d036baf9e1b2a


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Update login authentication mechanism Support Azure CLI v2.69.0+ managed identity authentication parameter change Feb 4, 2026
Copilot AI requested a review from Jury1981 February 4, 2026 15:53
@github-actions github-actions Bot added the Stale label Feb 18, 2026
@github-actions

github-actions Bot commented Mar 4, 2026

Copy link
Copy Markdown

This PR is idle because it has been open for 14 days with no activity.

@github-actions

github-actions Bot commented Apr 1, 2026

Copy link
Copy Markdown

This PR is idle because it has been open for 14 days with no activity.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants