How to use Azure DevOps Extension for Azure CLI with Azure DevOps Server?
Asked Answered
B

4

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.

Bairam answered 1/6, 2019 at 14:30 Comment(0)
W
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

Wherewith answered 27/6, 2019 at 9:9 Comment(0)
M
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
    
Messiah answered 18/3, 2020 at 8:20 Comment(0)
T
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.

Tisbee answered 1/6, 2019 at 14:48 Comment(1)
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.Bairam
G
0

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

Goodnatured answered 27/4, 2020 at 13:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.