Skip to content

Support Azure Artifacts as a core scenario #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
chriskuech opened this issue Jun 7, 2019 · 11 comments · Fixed by #449
Closed

Support Azure Artifacts as a core scenario #48

chriskuech opened this issue Jun 7, 2019 · 11 comments · Fixed by #449

Comments

@chriskuech
Copy link

JavaScript, C#, Java, and Python all have well-defined processes for

  • publishing and hosting private modules in Azure Artifacts
  • using Azure Artifacts as a secure mirror for public repositories

While there was a recently published guide on the subject, I have been unable to get it working (presumably due to PowerShell/PowerShellGetv2#433 ), and even still, there is no information on added PowerShell Gallery as an upstream package source, so there is no way of applying Component Governance to PowerShell modules or avoiding downloading from a public repository, which is forbidden in many security contexts.

Using Azure Artifacts as a private repository and mirror should be a core priority for PowerShellGet, as it enables PowerShell developers to operate at the same pedigree as application developers. Please use this scenario when prioritizing features and writing documentation.

@chriskuech
Copy link
Author

If this gets implemented, it would be amazing to have PowerShell be securely and automatically configured with just two simple commands.

@alerickson
Copy link
Member

Hi @chriskuech the blog post needs to be updated. You can try testing out the credential provider by registering a repository (right now credentials are not needed [due to PowerShell/PowerShellGetv2#433]). You can then run Find-Module on that repository. You'll get prompted for credentials, but you can also set up an environment variable if you want a non-interactive experience.

@chriskuech
Copy link
Author

Would it be possible to set PowerShell Gallery as a nuget upstream target for my Azure Artifacts feed? If so, what would be the URL to add as the nuget upstream target?

@Jaykul
Copy link
Contributor

Jaykul commented Jun 14, 2019

I'm sorry, this is rubbish.

We have to provide credentials for every request? Why? Why can't this work like every other azure CLI tool and just cache the credential (forever) by default?

@chriskuech
Copy link
Author

You don't have to "provide credentials for every request". @alerickson posted a link for setting up non-interactive login in his reply. It would be nice if it behaved like AzureRM's cred caching though...

@Jaykul
Copy link
Contributor

Jaykul commented Jun 14, 2019

@chriskuech Malarkey. Did you actually get the environment variable to work?

Here's what happened when I tried: PowerShell/PowerShellGetv2#499

@alerickson
Copy link
Member

alerickson commented Jul 1, 2019

@Jaykul @chriskuech I just published PowerShellGet and PackageManagement to our int gallery (www.poshtestgallery.com/api/v2). Please feel free to test these out and see if behavior is working appropriately. The credential provider should only be prompted if the -credential parameter is not passed in.

You can register the int gallery and install the respective modules by running:

Register-PSRepository -Name PoshTestGallery -SourceLocation https://www.poshtestgallery.com/api/v2
Install-Module PowerShellGet, PackageManagement -Repository PoshTestGallery -Force

@alerickson alerickson reopened this Jul 1, 2019
@chriskuech
Copy link
Author

so we create a pscredential with a $null username and the PAT token as the password?

@alerickson
Copy link
Member

@chriskuech you can use the -credential parameter with a pscredential object (with the appropriate username associated with the PAT). If you don't use the -credential parameter the credential provider will prompt for credentials.

@chriskuech
Copy link
Author

Sorry I just tried with v2.2.1 and I'm still seeing issues depending on the feed url I use.

WARNING: Unable to resolve package source '<feed-url>/index.json'.
Register-PsRepository : The specified Uri '<feed-url>' for parameter 'SourceLocation' is an invalid Web Uri. Please ensure that it meets the Web Uri requirements.

@alerickson alerickson transferred this issue from PowerShell/PowerShellGetv2 Mar 30, 2020
@Happycoil
Copy link

Is this resolved in Preview 1? I'm getting the following (url has been anonymized):

PS /Users/tm> Register-PSResourceRepository -Name test-powershell -URL "https://pkgs.dev.azure.com/<org>/<project>/_packaging/test-powershell/nuget/v3/index.json" -Credential $creds
PS /Users/tm> Find-PSResource -Repository test-powershell -Credential $creds
No cursor found. Defaulting to 01/01/0001 00:00:00.
Find-PSResource: Unable to load the service index for source https://pkgs.dev.azure.com/<org>/<project>/_packaging/test-powershell/nuget/v3/index.json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants