`az devops login` with `az login` still requests personal access token

12.6k Views Asked by At

I have started using Azure Pipelines with GitHub backed account and created my first organization. I do not have any projects in that organization. I also do not have any subscriptions on portal.azure.com. I want to list available project in my organization using Azure CLI - basically - to get an empty list, because there are no projects yet.

When I type

az login --allow-no-subscriptions

I login successfully using a browser. But all the other Azure CLI commands that I issue afterwards will fail, and ask to login. What's in the name?

After a successful az login, when I type

az devops login --organization https://dev.azure.com/my-org-name-i-will-not-tell-you/

it prompts me for token, which is confusing, because from the official documentation:

If you have already signed in with az login interactively or using user name and password, then you don't have to provide a token as az devops commands now support sign in through az login.

I am confused, why I cannot login. Do I need to create a subscription on portal.azure.com to login? I don't want to do it, and don't' see why that will be necessary for my task.

2

There are 2 best solutions below

1
On

If you login through

az login --allow-no-subscriptions

there is no need to call az devops login as you have access to Azure DevOps. Anf if you want to configure default organization, you can always use az devops configure

But it looks like mistake on CLI or documentation. I would recommend you create an issue for this page on GitHub.

0
On

The documentation indicates if you have already signed in with az login interactively or using user name and password, then you don't have to provide a token as az devops commands now support sign in through az login. In my opinion, the az devops commands here doesn't include az devops login command, as you don't need to run az devops login command after you running az login command.