azure-devops-cli-extension icon indicating copy to clipboard operation
azure-devops-cli-extension copied to clipboard

az devops login errors out while installing python keyring package

Open PushkarVaity opened this issue 3 years ago • 4 comments

Hi,

We started seeing this issue at work all of a sudden while running the az devops login command as part of a script (Can see the following error even when running 'az devops login' standalone on command line). The exact command script calls is: cat ~/.ssh/ado.pat | az devops login

WARNING: Unable to use secure credential store in this environment. WARNING: Please refer to alternate methods at https://aka.ms/azure-devops-cli-auth WARNING: using Environment variable WARNING: or use 'az login' ERROR: An error occurred. Pip failed with status code 1 for package keyring~=17.1.1. Use --debug for more information.

The azure-cli version on linux distribution (CentOS 7) is 2.18.0 % az --version azure-cli 2.18.0 *

I do not see this issue in 2.17.1 version. Couple users complained seeing it on machines with version 2.18.0 installed. Can you please let me know what might be causing this as it's causing many flows to error out. Is there anything that we might be missing on our end?

Originally posted by @PushkarVaity in https://github.com/Azure/azure-devops-cli-extension/issues/438#issuecomment-776151570

PushkarVaity avatar Feb 09 '21 18:02 PushkarVaity

Faced with the same issue on ACI based on Ubuntu 18.04 image, and Python 3.6.9 Python 3.6.9 and pip 18.1 On attempt to login in Azure DevOps it tries to install 'keyring~=17.1.1':

2021-03-03T16:23:57.4469542Z DEBUG: cli.azure.cli.core.extension.operations: Command '['/opt/az/bin/python3', '-m', 'pip', 'install', 'keyring~=17.1.1', '--target', '/root/.azure/cliextensions/azure-devops', '-vv', '--disable-pip-version-check', '--no-cache-dir']' returned non-zero exit status 1.

The command fails because of dependencies: azure-cli 2.18.0 has requirement cryptography<3.0.0,>=2.3.1, but you'll have cryptography 3.4.6 which is incompatible. azure-cli-core 2.20.0 has requirement cryptography<3.4,>=3.2, but you'll have cryptography 3.4.6 which is incompatible.

(I can provide full trace)

pip upgrade to 21.0.1 helped: python3 -m pip install --upgrade pip

Here is similar issue: https://github.com/Azure/azure-cli/issues/16858

rstarov avatar Mar 03 '21 20:03 rstarov

I can confirm that updating pip to latest version in this target location /usr/lib64/az/lib/python3.6/site-packages/ helped solve the following error:

Unable to use secure credential store in this environment. Please refer to alternate methods at https://aka.ms/azure-devops-cli-auth using Environment variable or use ‘az login’ An error occurred. Pip failed with status code 1 for package keyring~=17.1.1. Use --debug for more information.

This still leaves me with the following keyring related issue while executing (cat ~/.ssh/ado.pat | az devops login --org https://dev.azure.com/my_org/):

Failed to store PAT using keyring; falling back to file storage. You can clear the stored credential by running az devops logout. Refer https://aka.ms/azure-devops-cli-auth to know more on sign in with PAT.

This does not always translate to loss of functionality. Can someone help with this message?

PushkarVaity avatar Mar 03 '21 23:03 PushkarVaity

I ran in to this issue as well trying to download universal artifacts. My solution was to remove the 'az devops login' step and simply use:

AZURE_DEVOPS_EXT_PAT={your PAT} az artifacts universal download ...

This is an environment variable known to the Azure cli.

JerryJoyce avatar Mar 04 '21 01:03 JerryJoyce

thanks @JerryJoyce - your solution worked

@ microsoft business tools mh?

# az devops login --organization https://dev.azure.com/{{ myorg }}/
Failed to store PAT using keyring; falling back to file storage.
You can clear the stored credential by running az devops logout.
Refer https://aka.ms/azure-devops-cli-auth to know more on sign in with PAT.
root@debian:~# az version
{
  "azure-cli": "2.35.0",
  "azure-cli-core": "2.35.0",
  "azure-cli-telemetry": "1.0.6",
  "extensions": {
    "azure-devops": "0.25.0"
  }
}

mrwiora avatar Apr 21 '22 15:04 mrwiora