Skip to content

Conversation

Copy link

Copilot AI commented Feb 2, 2026

Azure CLI v2.69.0 replaced --username with --client-id for user-assigned managed identity authentication (azure-cli#30525). This implements version detection to maintain backward compatibility.

Changes

  • Version detection: Parse Azure CLI version during login initialization and store in azVersion property
  • Conditional parameter selection: Use --username for CLI < 2.69.0, --client-id for >= 2.69.0 in loginWithUserAssignedIdentity()
  • Error handling: Graceful fallback to legacy behavior if version parsing fails

Implementation

async loginWithUserAssignedIdentity(args: string[]) {
    let azcliMinorVersion = 0;
    try {
        azcliMinorVersion = parseInt(this.azVersion.split('.')[1], 10);
    }
    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');
}
Original prompt

Reference: bbcc074


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Update Azure Functions with latest commit Add Azure CLI v2.69.0+ compatibility for user-assigned managed identity authentication Feb 2, 2026
Copilot AI requested a review from Jury1981 February 2, 2026 08:23
@Jury1981 Jury1981 marked this pull request as ready for review February 3, 2026 22:56
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