PowerShell / PSResourceGet

PSResourceGet is the package manager for PowerShell
https://www.powershellgallery.com/packages/Microsoft.PowerShell.PSResourceGet
MIT License
486 stars 92 forks source link

Azure Artifacts Credential Provider: Response status code 401 (Unauthorized) when connecting to ADO Feed. PowerShellGet module 3.0.0-beta10 #427

Closed nbdinara closed 3 years ago

nbdinara commented 3 years ago

Hello!

I am getting an 401 (Unauthorized) error when I try to connect to private ADO Feed using Azure Artifacts Credential Provider. Could you please help me to solve this issue?

I wanted to use Azure Credential Provider to supply personal access token and store it in environment variable VSS_NUGET_EXTERNAL_FEED_ENDPOINTS to provide to user seamless experience. I used this documentation: GitHub - microsoft/artifacts-credprovider: The Azure Artifacts Credential Provider enables dotnet, NuGet.exe, and MSBuild to interactively acquire credentials for Azure Artifacts feeds.

I installed the latest PowerShellGet module 3.0.0-beta10. When I executed command: Find-PSResource -ModuleName --Prerelease -Repository I got the 401 code error.

image

Below are the actions that I already have done:

1) Result of running the credential provider directly: https://github.com/Microsoft/artifacts-credprovider#how-do-i-find-out-if-my-issue-is-a-real-401

image

2) I also tried to play with $accessToken value and set it to $accessToken = "$B64Pat" and $accessToken = "Basic $B64Pat", but got the same error. 3)I played with url to the feed too. I used “https://.pkgs.visualstudio.com/36d6487b-86e3-45b4-8db5-e005872078d6/_packaging//nuget/v3/index.json” as value, but got the same error again.

4) When I did the same set of actions using PowerShellGet module 2.2.5, I get the error “No match was found for the specified search criteria and module name 'PbiWb'. Try Get-PSRepository to | see all available registered module repositories.”

image

Result of running the credential provider directly:

image

I have Owner level permission to the feed that I am trying to access:

Thank you, -Dinara

alerickson commented 3 years ago

Hi @nbdinara unfortunately we do not yet have credential persistence for PowerShellGet 3.x yet. Our plan is to actually implement credential persistence that is a bit more simple to set up and use than the Azure Artifacts Credential provider. We are planning on integrating with SecretManagement and the SecretStore to provide for a better and smoother experience.

We are tracking this issue and its development here #330 and here #64.

Please let us know if you any suggestions or feedback for this issue!