2
votes

I'm trying to get Azure DevOps Artifacts service up and running. I can get it to work with the 90-day token generated by DevOps but not with a custom PAT generated by my account Security panel. It just gives me a 401 error. I followed the instructions for the PAT from here: PAT instructions

My registry url is https://pkgs.dev.azure.com/mycompany/_packaging/packages/npm/registry/

My extension .npmrc file is like this:

registry=https://pkgs.dev.azure.com/mycompany/_packaging/packages/npm/registry/
always-auth=true

My system .npmrc is like this:

//registry.npmjs.org/:_authToken=xxxxxxxxxxxxxxxxxxxxxxxx
//pkgs.dev.azure.com/mycompany/_packaging/packages/npm/registry/:username=mycompany
//pkgs.dev.azure.com/mycompany/_packaging/packages/npm/registry/:_password=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//pkgs.dev.azure.com/mycompany/_packaging/packages/npm/registry/:[email protected]
//pkgs.dev.azure.com/mycompany/_packaging/packages/npm/registry/:always-auth=true

If it helps, here's the settings I used to generate the PAT:

DevOps PAT settings

Any guesses where I might be going wrong?

1
Open the Artifacts > Feed > Feed Settings (Cog) > Permissions . Are you a contributor or owner for the feed you are trying to upload to? - Dejulia489
For future reference, you should redact things like auth tokens when posting logs to public sites. You redacted your account name, but your profile shows your employer and that's all a determined attacker needs. - Daniel Mann
@DanielMann I totally agree. I left it in because there was a previous issue reported where the instructions were Base64 encoding the token incorrectly. I wanted to show that it was the correct format. Don't worry though, I'd already revoked the token before posting. - Jason
@michaeldejulia Yes, I'm the owner for the feed. - Jason

1 Answers

3
votes

Any guesses where I might be going wrong?

Please have a try to generate a PAT with a narrow scope of "Packaging (read and write), not build permission. You could click the [show all scopes] to find it.

For more information, please refer to set up your npmrc files

enter image description here

enter image description here