5

The Azure CLI with the Azure DevOps extension has replaced the VSTS CLI. But I can't find any sample on how to connect to Team Foundation Server (TFS) or Azure DevOps Server using Azure CLI with Azure DevOps extension.

I tried to create a PAT on my Azure DevOps Server with all scope permission. Then I use the following command to login:

az devops login --organization https://vm-dev-cgudevops/DefaultCollection --verbose

Here is what I've got:

C:\>az devops login --organization https://vm-dev-cgudevops/DefaultCollection --verbose
Token:
Creating connection with personal access token.
Failed to authenticate using the supplied token.
Suppress exception There are no active accounts.
Suppress exception Please run 'az login' to setup account.
command ran in 25.138 seconds.

The token can't be wrong. I don't know what's going on.

Will Huang
  • 2,955
  • 2
  • 37
  • 90

4 Answers4

5

At present Azure DevOps CLI is not supported for Azure DevOps server. This is fundamentally due to API versioning as Azure DevOps Server runs on a particular version but the CLI client consistently updates to the latest version. Therefore, ideally if you are using the latest version of Azure DevOps Server, then the CLI should work for you as both are using the same API versions.

Have a look at the docs available at - https://learn.microsoft.com/en-us/azure/devops/cli/index?view=azure-devops

4

Azure Cli support login your private TFS currently, see: https://learn.microsoft.com/en-us/azure/devops/cli/log-in-via-pat?view=azure-devops&tabs=windows

  1. Create PAT
  2. Login with PAT, eg.
    cat PAT.txt | az devops login --organization http://your_tfs_url
    
gunr2171
  • 16,104
  • 25
  • 61
  • 88
Aaron
  • 91
  • 2
1

There is an extension in Azure DevOps that let's you mange the Azure DevOps from Azure CLI.

As mentioned in the extension you have to :

  1. Install the Azure CLI. You must have at least v2.0.49, which you can verify with az --version command.

  2. Add the Azure DevOps Extension az extension add --name azure-devops

  3. Run the az login command.

You can also find a sample for it here.

Read this article if you need more information about how to get started with it.

Benjamin
  • 3,499
  • 8
  • 44
  • 77
  • 2
    I know these info, but I still don't know how to login into Azure DevOps Server. There is no example for that. So my question is: 1. How to login? Using `az login` or `az devops login` or both? 2. I tried to create a PAT on my Azure DevOps Server and use `az devops login --org myURL --verbose` to login, but I got `Failed to authenticate using the supplied token.` and `Suppress exception There are no active accounts.` response. – Will Huang Jun 01 '19 at 15:26
0

Add /tfs/DefaultCollection to URL. That did the trick for me.

akamac
  • 31
  • 3