1

I'm setting up a system that is installing a tool via:

dotnet tool install MyTool --tool-path . --add-source <my-source-url>

The source I'm trying to get from is an Azure artifacts feed, and so will need authentication to access. Reading the dotnet tool's docs, I can't seem to find a way to authenticate to a source e.g. via a personal access token.

Since this will be an automated system, I cannot use the --interactive flag. Are there workarounds for this or is there no way to authenticate for the dotnet tool install command?

1 Answer 1

0

Hi I just had a similar issue.

You need to prepare a nuget.config file with credentials in your pipeline and then use the nuget.config file.

Step 1: Checkin default NuGet.Config file

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>
</configuration>

Step 2: In my case in azure pipelines manipulate ./NuGet.Config and install the tool

  - script: dotnet nuget add source --configfile ./NuGet.Config "https://pkgs.dev.azure.com/.../nuget/v3/index.json" --name "SomeName" -u "-" -p "$(System.AccessToken)" --store-password-in-clear-text
    displayName: "Add NuGet source"

  - script: dotnet tool install -g --configfile ./NuGet.Config My.KafkaCleaner.Tool
    displayName: "Install My.KafkaCleaner.Tool"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.