Publishing DSC resources to local PSGallery

This topic contains 7 replies, has 3 voices, and was last updated by  Aurimas N. 2 weeks, 4 days ago.

  • Author
    Posts
  • #83161

    Aurimas N.
    Participant

    Hi,
    how do I publish dsc resources to local psgallery so I can find them with find-dscresource?
    I was not able to do that with publish-module, must be missing something:

    1. I've created class based dsc resource as described here: https://docs.microsoft.com/en-us/powershell/dsc/authoringresourceclass (basically copy pasted the resource for testing)
    2. Verified locally that the dsc resource is available via

    Get-DscResource

    3. Published it to local PS repository

    Publish-Module -Name FileResource -Repository 'localpsrepo' -NuGetApiKey mykey

    Find-Module -Repository 'localpsrepo' lists FileResource module
    Find-DSCResource -Repository 'localpsrepo' lists no results

  • #83219

    Jeremy Murrah
    Participant

    Maybe something in your manifest metadata that it doesn't like? Try publishing one of the "official" dsc resource modules to your repository, like xPSDesiredStateConfiguration, see if you can find that once it's published.

  • #83224

    Aurimas N.
    Participant

    I have already tried few modules I've saved from PSGallery, the result is the same, module is listed, but not the dsc resources.

  • #83243

    Aurimas N.
    Participant

    Just tried it with MyGet.org, same result, either I'm repeating same mistake, or this is just not working with private/internal nuget repositories?

  • #83258

    J. Keith Bankston
    Participant

    In the PS Gallery this works based on either the tag: DSCResource or DSC.
    Please check to see if you have the latest version of PowerShellGet from the PowerShell Gallery, as we made changes a while ago to make this work seamlessly. The current version will extract those tags from PrivateData\PsData section of the module manifest, and feed it to the NuGet client automatically.
    You can try specifying these tags using Publish-Module ... -Tags DSCResource,DSC
    If that doesn't work, please report this as an issue in github.com/powershell/powershellget. We'll need the following info:
    $psversiontable;
    get-module powershellget -li

    • #83270

      Aurimas N.
      Participant

      I have updated powershellget to 1.5.0.0, tried to publish-module with -tags DSC,DSCResource the result was the same.
      On another note, Find-DSCResource lists dsc resources if I specify the -modulename parameter.

  • #83272

    Jeremy Murrah
    Participant

    So for reference I use an internal repository server I created using the nuget dsc module. Very barebones but I'm able to publish and find dsc resources on that server with no issue. Maybe give that one a try and see if you have the same issue?

  • #83470

    Aurimas N.
    Participant

    Got an answer on github that myget does not tag based searches, I guess same goes for artifactory.
    https://github.com/PowerShell/PowerShellGet/issues/184

You must be logged in to reply to this topic.