0

I am using azure devops to host an authenticated NPM feed. I would like to generate a token to access that feed using the CLI. The instructions on azure devops involve going through the web interface to generate a personal access token (PAT), then base64-ing that token, and adding it to the .npmrc. If I do that, I'm able to run npm install against that feed without issue.

In the CLI, I've tried using az account get-access-token, grabbing that token, and encoding it. But that seems to fail, and I guess that makes sense because it is a token for azure itself, not azure devops.

Does anyone have any guidance on how this could be done? Am I stuck doing it manually?

Jake Stevenson
  • 3,009
  • 6
  • 35
  • 40

1 Answers1

1

az account get-access-token get a token for utilities to access Azure.

It's not Azure DevOps.

We also have an az devops CLI command. But we could not be able to get/create a token through this. Neither does Rest API.

You'll have to manually create the PAT token from web interface in your Azure DevOps Organization.

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • I agree that it kind of makes sense that `az account get-access-token` applies to azure, not azure devops. But interestingly, I CAN use that access token with the authenticated nuget feed provider. – Jake Stevenson Mar 27 '20 at 18:34
  • Hi @JakeStevenson Thanks for the sharing. Have you also give a test with the token `az account get-access-token` on some other areas such as Git command, build ? Will it also work with them? If not, I am afraid, it's something special with nuget feed side. – PatrickLu-MSFT Mar 28 '20 at 02:44