Skip to content

Sporadic kubelogin command not foundΒ #32313

@aravindsemp

Description

@aravindsemp

Describe the bug

We're getting sporadic kubelogin: command not found error on our self-hosted VMSS ADO build agents. kubelogin and kubectl are being installed with az aks install-cli command as part of the custom scripts on the agents.

Most of our jobs have we set the kube context for kubectl with the following code and run kubectl and helm commands subsequently.

# Set Kubernetes context
 az aks get-credentials --resource-group ${{ parameters.ResourceGroupName }} --name ${{ parameters.AksName }} --overwrite-existing
 kubelogin convert-kubeconfig -l azurecli
 kubectl get pods             

It used to work without any issues. But, in the recent past we have been encountering the following error -

WARNING: Merged "aks-cluster-test-lab01-eastus" as current context in /home/AzDevOps/.kube/config
WARNING: The kubeconfig uses devicecode authentication which requires kubelogin. Please install kubelogin from https://github.com/Azure/kubelogin or run 'az aks install-cli' to install both kubectl and kubelogin. If devicecode login fails, try running 'kubelogin convert-kubeconfig -l azurecli' to unblock yourself.
/agent/_work/_temp/azureclitaskscript1761144036262.sh: line 5: kubelogin: command not found

##[error]Script failed with exit code: 127

Related command

# Set Kubernetes context
 az aks get-credentials --resource-group ${{ parameters.ResourceGroupName }} --name ${{ parameters.AksName }} --overwrite-existing
 kubelogin convert-kubeconfig -l azurecli
 kubectl get pods             

Errors

WARNING: Merged "aks-cluster-test-lab01-eastus" as current context in /home/AzDevOps/.kube/config
WARNING: The kubeconfig uses devicecode authentication which requires kubelogin. Please install kubelogin from https://github.com/Azure/kubelogin or run 'az aks install-cli' to install both kubectl and kubelogin. If devicecode login fails, try running 'kubelogin convert-kubeconfig -l azurecli' to unblock yourself.
/agent/_work/_temp/azureclitaskscript1761144036262.sh: line 5: kubelogin: command not found

##[error]Script failed with exit code: 127

Issue script & Debug output

NA

Expected behavior

kubelogin should be found to run set the kube config

Environment Summary

/usr/bin/az --version
azure-cli 2.78.0

core 2.78.0
telemetry 1.1.0

Extensions:
azure-devops 1.0.2

Dependencies:
msal 1.34.0b1
azure-mgmt-resource 23.3.0

Python location '/opt/az/bin/python3'
Config directory '/home/AzDevOps/.azure'
Extensions directory '/home/AzDevOps/.azure/cliextensions'

Python (Linux) 3.13.7 (main, Oct 9 2025, 05:49:51) [GCC 11.4.0]

Legal docs and information: aka.ms/AzureCliLegal

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    AKSaz aks/acs/openshiftAuto-AssignAuto assign by botService AttentionThis issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions