azure-devopspaketazure-artifacts

Generate an API key for VSTS package manager


I use paket as a dependency management tool and am just starting to use Visual Studio online (VSO) to host the source and do the building.

When I do a paket restore (or try to upload a nupkg) I get a 401. VSTS uses a credential manager which seems to generate a unique password each time it's run. I suppose I could write a powershell script to execute the credential manager.exe and pull out the password/username then set it for Paket before doing a restore but ideally I'd like to create a specific user (and password) for the feed only, or generate an api key. Does anyone know if this is possible?


Solution

  • Paket supports provide username and password in paket.dependencies file, so you can create a personal access token with packaging scope (e.g. Packaging (read and write)), then specify it in paket.dependencies file, for example:

    source [your feed url] username: "[anything, such as test]" password: "[personal access token]"
    
    nuget [library]
    

    More information: plaintext-credentials