(dsc): Support credentials, `acceptLicense` and PSGallery registration

Open
#2,049 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
csharp, powershell
Domain
security, tooling

Research direction

Start by tracing the Repository registration flow for Register-PSResourceRepository and the PSResourceList install flow for Install-PSResource. Verify PSGallery parameter-set handling, credentialInfo and acceptLicense support, then check that get, test and export expose only vault and secret names.

Written by the indexing model from the issue text.

Description

feature_request Needs-Triage
Summary of the new feature / enhancement

The DSC resources cannot express three things that the underlying cmdlets support and that are needed in real deployments:

  1. Credentials. Register-PSResourceRepository -CredentialInfo and Install-PSResource -Credential are not modelled, so a private feed (Azure Artifacts, GitHub Packages, an internal NuGet server) cannot be used from a configuration.
  2. acceptLicense. Install-PSResource -AcceptLicense is not passed, so a module that requires license acceptance fails during set with exit code 4.
  3. PSGallery registration. Register-PSResourceRepository -PSGallery is a separate parameter set. Declaring { name: PSGallery } in a Repository instance on a machine where it was unregistered fails, because the script always calls Register-PSResourceRepository -Name -Uri.

Example of what this could look like:

resources:
- name: Internal feed
  type: Microsoft.PowerShell.PSResourceGet/Repository
  properties:
    name: Internal
    uri: https://pkgs.dev.azure.com/contoso/_packaging/internal/nuget/v3/index.json
    trusted: true
    credentialInfo:
      vaultName: ContosoVault
      secretName: InternalFeedPat
- name: Modules
  type: Microsoft.PowerShell.PSResourceGet/PSResourceList
  properties:
    repositoryName: Internal
    acceptLicense: true
    resources:
    - name: Contoso.Tools
Proposed technical implementation details (optional)
  • Repository: add an optional credentialInfo object (vaultName, secretName) mapped to -CredentialInfo on register and set, and handle name: PSGallery without uri by calling Register-PSResourceRepository -PSGallery.
  • PSResourceList: add an optional acceptLicense boolean passed to Install-PSResource -AcceptLicense, and allow credential via SecretManagement rather than plain text in the configuration.
  • Never emit secrets in get, test or export output; return only the vault and secret names.
Dominant language
C#
Stars
576
Forks
114
Avg merge
1d 2h
Merged PRs (30d)
7

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PowerShell/PSResourceGet

All issues in PowerShell/PSResourceGet

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.