{"id":19514,"date":"2022-05-31T07:18:34","date_gmt":"2022-05-31T15:18:34","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/powershell\/?p=19514"},"modified":"2022-06-10T07:49:03","modified_gmt":"2022-06-10T15:49:03","slug":"powershellget-3-0-preview-14","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/powershellget-3-0-preview-14\/","title":{"rendered":"PowerShellGet 3.0 Preview 14"},"content":{"rendered":"<p dir=\"auto\">We are excited to announce that an update to our preview of PowerShellGet 3.0 is now available on the PowerShell Gallery!<\/p>\n<p dir=\"auto\">This release includes support for PSResourceRepository credential persistence, as well as support for RequiredResourceFiles for Install.<\/p>\n<h2 dir=\"auto\"><a id=\"user-content-how-to-install-powershellget-30-preview-13\" class=\"anchor\" href=\"https:\/\/github.com\/PowerShell\/PowerShell-Blog\/blob\/main\/Posts\/2022-05-31-PowerShellGet-Preview-13.md#how-to-install-powershellget-30-preview-13\" aria-hidden=\"true\"><\/a>How to Install PowerShellGet 3.0 Preview 14<\/h2>\n<h3 dir=\"auto\"><a id=\"user-content-prerequisites\" class=\"anchor\" href=\"https:\/\/github.com\/PowerShell\/PowerShell-Blog\/blob\/main\/Posts\/2022-05-31-PowerShellGet-Preview-13.md#prerequisites\" aria-hidden=\"true\"><\/a>Prerequisites<\/h3>\n<p dir=\"auto\">Please ensure that you have the latest (non-prerelease) version of PowerShellGet and PackageManagement installed. To check the version you currently have installed run the command\u00a0<code>Get-InstalledModule PowerShellGet, PackageManagement<\/code><\/p>\n<p dir=\"auto\">The latest version of PowerShellGet is 2.2.5, and the latest version of PackageManagement is 1.4.7. To install the latest versions of these modules run the following:\u00a0<code>Install-Module PowerShellGet -Force -AllowClobber<\/code><\/p>\n<h3 dir=\"auto\"><a id=\"user-content-installing-the-preview\" class=\"anchor\" href=\"https:\/\/github.com\/PowerShell\/PowerShell-Blog\/blob\/main\/Posts\/2022-05-31-PowerShellGet-Preview-13.md#installing-the-preview\" aria-hidden=\"true\"><\/a>Installing the Preview<\/h3>\n<p dir=\"auto\">To install this preview release side-by-side with your existing PowerShellGet version, open any PowerShell console and run:\u00a0<code>Install-Module PowerShellGet -Force -AllowPrerelease<\/code><\/p>\n<h2 dir=\"auto\"><a id=\"user-content-what-to-expect-in-this-update\" class=\"anchor\" href=\"https:\/\/github.com\/PowerShell\/PowerShell-Blog\/blob\/main\/Posts\/2022-05-31-PowerShellGet-Preview-13.md#what-to-expect-in-this-update\" aria-hidden=\"true\"><\/a>What to expect in this update<\/h2>\n<p dir=\"auto\">The key features and bug fixes are listed below, for the full list of changes please refer to the\u00a0<a href=\"https:\/\/github.com\/PowerShell\/PowerShellGet\/blob\/master\/CHANGELOG.md\">Changelog<\/a>.<\/p>\n<h3 dir=\"auto\"><a id=\"user-content-features-of-this-release\" class=\"anchor\" href=\"https:\/\/github.com\/PowerShell\/PowerShell-Blog\/blob\/main\/Posts\/2022-05-31-PowerShellGet-Preview-13.md#features-of-this-release\" aria-hidden=\"true\"><\/a>Features of this release<\/h3>\n<ul dir=\"auto\">\n<li>-Scope parameter for Get-PSResource and Uninstall-PSResource<\/li>\n<li>\u00a0-CredentialInfo parameter for Register-PSResourceRepository<\/li>\n<li>Clt+C support for Find-PSResource<\/li>\n<li>-RequiredResource parameter for Install-PSResource<\/li>\n<li>Publish-PSResource Script publishing support<\/li>\n<li>-Prerelease\u00a0support for Uninstall-PSResource<\/li>\n<li>Install-PSResource -RequiredResourceFile parameter for psd1 and json<\/li>\n<li>-RequiredResource parameter Install-PSResource<\/li>\n<\/ul>\n<h3 dir=\"auto\"><a id=\"user-content-bug-fixes\" class=\"anchor\" href=\"https:\/\/github.com\/PowerShell\/PowerShell-Blog\/blob\/main\/Posts\/2022-05-31-PowerShellGet-Preview-13.md#bug-fixes\" aria-hidden=\"true\"><\/a>Bug Fixes<\/h3>\n<ul dir=\"auto\">\n<li>RequiredModules support for publishing<\/li>\n<li>Register-PSResourceRepository -Repositories parameter renamed to -Repository<\/li>\n<li>Rename PSResourceInfo&#8217;s PrereleaseLabel property to match Prerelease column displayed<\/li>\n<li>Parameter consistency: change url to uri<\/li>\n<\/ul>\n<h2 dir=\"auto\"><a id=\"user-content-using-credential-persistence\" class=\"anchor\" href=\"https:\/\/github.com\/PowerShell\/PowerShell-Blog\/blob\/main\/Posts\/2022-05-31-PowerShellGet-Preview-13.md#using-credential-persistence\" aria-hidden=\"true\"><\/a>Using Credential Persistence<\/h2>\n<p dir=\"auto\">This community contributed feature allows you to provide information about where a credential is stored when registering the PSResourceRepository using a\u00a0<code>-CredentialInfo<\/code> parameter. This parameter takes a PSCredentialInfo object which takes a vault name and secret name. The secret will then be pulled to authenticate to the Repository on Find and Install calls. This feature takes advantage of SecretManagement, for more information on SecretManagement refer <a href=\"https:\/\/docs.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.secretmanagement\/?view=ps-modules\" rel=\"nofollow\">the documentation<\/a>.<\/p>\n<h3 dir=\"auto\"><a id=\"user-content-requirements\" class=\"anchor\" href=\"https:\/\/github.com\/PowerShell\/PowerShell-Blog\/blob\/main\/Posts\/2022-05-31-PowerShellGet-Preview-13.md#requirements\" aria-hidden=\"true\"><\/a>Requirements<\/h3>\n<ul dir=\"auto\">\n<li>Microsoft.PowerShell.SecretManagement<\/li>\n<li>Any vault extension registered (for this example I will use Microsoft.PowerShell.SecretStore)<\/li>\n<li>A repository to connect to (for this example I will use Artifactory)<\/li>\n<\/ul>\n<h3 dir=\"auto\"><a id=\"user-content-getting-started\" class=\"anchor\" href=\"https:\/\/github.com\/PowerShell\/PowerShell-Blog\/blob\/main\/Posts\/2022-05-31-PowerShellGet-Preview-13.md#getting-started\" aria-hidden=\"true\"><\/a>Getting started<\/h3>\n<p dir=\"auto\">For this example I am going to be using SecretStore to store my credentials for an Artifactory repository. This can be repeated with any SecretManagement extension vault, and with any repository. First, I need to make sure I have a SecretManagement vault set up, with my credential stored. Currently this feature only supports the PSCredential secret type, however, we have\u00a0<a href=\"https:\/\/github.com\/PowerShell\/PowerShellGet\/issues\/652\" data-hovercard-type=\"issue\" data-hovercard-url=\"\/PowerShell\/PowerShellGet\/issues\/652\/hovercard\">an issue<\/a>\u00a0to track support for other types.<\/p>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\">\n<pre class=\"notranslate\"><code>PS C:\\Users &gt; Get-SecretInfo\r\nName          Type         VaultName\r\n----          ----         ---------\r\njFrogCred     PSCredential SecretStore\r\n<\/code><\/pre>\n<\/div>\n<p dir=\"auto\">Then I can create a PSCredentialInfo object to pass into my PSResourceRepository registration, to create this I pass in the name of the vault and the name of the secret.<\/p>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\">\n<pre class=\"notranslate\"><code>$credentialInfo = New-Object Microsoft.PowerShell.PowerShellGet.UtilClasses.PSCredentialInfo (\"SecretStore\", \"jfrogCred\")\r\n<\/code><\/pre>\n<\/div>\n<p dir=\"auto\">Now I am ready to register the PSResourceRepository, I will pass in a friendly name, a URI for the repository, and the CredentialInfo. I also use the\u00a0<code>-Trusted<\/code> switch because I will be controlling what gets published to the repository.<\/p>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\">\n<pre class=\"notranslate\"><code>Register-PSResourceRepository -Name artifactory `\r\n-URI \" https:\/\/&lt;name&gt;.jfrog.io\/artifactory\/api\/nuget\/v3\/&lt;Repository-Name&gt;\r\n-Trusted `\r\n-CredentialInfo $credentialInfo \r\n<\/code><\/pre>\n<\/div>\n<p dir=\"auto\">Now I can run\u00a0<code>Get-PSResourceRepository<\/code>\u00a0to see my registered repositories<\/p>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\">\n<pre class=\"notranslate\"><code>PS C:\\Users &gt; Get-PSResourceRepository\r\n\r\nName        Uri                                                                                     Trusted Priority\r\n----        ---                                                                                     ------- --------\r\nartifactory https:\/\/&lt;name&gt;.jfrog.io\/artifactory\/api\/nuget\/v3\/&lt;Repository-Name&gt;                      True    50      \r\nPSGallery   https:\/\/www.powershellgallery.com\/api\/v2                                                False   50  \r\n<\/code><\/pre>\n<\/div>\n<p dir=\"auto\">If the repository is empty you are going to want to begin by publishing to it. I have saved my API key for publishing to the repository in my SecretStore.<\/p>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\">\n<pre class=\"notranslate\"><code>Publish-PSResource -Path .\\Get-Hello\\ -Repository artifactory -ApiKey (Get-Secret jfrogPublish)\r\n<\/code><\/pre>\n<\/div>\n<p dir=\"auto\">Now I can find and install PSResources from my repository without needing to provide a credential at each call.<\/p>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\">\n<pre class=\"notranslate\"><code>PS C:\\Users&gt; Find-PSResource -Name Get-Hello -Repository artifactory\r\n\r\nName      Version Prerelease Repository  Description\r\n----      ------- ---------- ----------  -----------\r\nGet-Hello 0.0.2.0            artifactory test module\r\n\r\nPS C:\\Users&gt; Install-PSResource Get-Hello\r\n<\/code><\/pre>\n<\/div>\n<h2 dir=\"auto\"><a id=\"user-content-using-required-resources\" class=\"anchor\" href=\"https:\/\/github.com\/PowerShell\/PowerShell-Blog\/blob\/main\/Posts\/2022-05-31-PowerShellGet-Preview-13.md#using-required-resources\" aria-hidden=\"true\"><\/a>Using Required Resources<\/h2>\n<p dir=\"auto\">Install-PSResource can accept a path to a psd1 or json file (using -RequiredResourceFile), or a hashtable or json (using -RequiredResource).<\/p>\n<h3 dir=\"auto\"><a id=\"user-content-getting-started-1\" class=\"anchor\" href=\"https:\/\/github.com\/PowerShell\/PowerShell-Blog\/blob\/main\/Posts\/2022-05-31-PowerShellGet-Preview-13.md#getting-started-1\" aria-hidden=\"true\"><\/a>Getting Started<\/h3>\n<p dir=\"auto\">The\u00a0<code>-RequiredResource<\/code>\u00a0parameter can take either a hashtable or a json format string. The following example shows how to format these inputs.<\/p>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\">\n<pre class=\"notranslate\"><code>Install-PSResource -RequiredResource @{\r\n  'Configuration' = @{\r\n    version = '[1.3.1,2.0]'\r\n    repository = 'PSGallery'                        \r\n   }\r\n  'Pester'        = @{\r\n    version = '[4.4.2,4.7.0]'\r\n    repository = 'PSGallery'\r\n    allowPrerelease = $true\r\n  }\r\n}\r\n<\/code><\/pre>\n<\/div>\n<p dir=\"auto\">In this case the modules named &#8220;Configuration&#8221;, and &#8220;Pester&#8221; will be installed. The json format will be the same as if this hashtable is passed to ConvertTo-Json:<\/p>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\">\n<pre class=\"notranslate\"><code>\"{\r\n  'Pester': {\r\n    'allowPrerelease': true,\r\n    'version': '[4.4.2,4.7.0]',\r\n    'repository': 'PSGallery'\r\n  },\r\n  'Configuration': {\r\n    'version': '[1.3.1,2.0]',\r\n    'repository': 'PSGallery'\r\n  }\r\n}\"\r\n<\/code><\/pre>\n<\/div>\n<p dir=\"auto\">\u00a0Declared dependencies are searched and installed using the same trust algorithm as for Install-PSResource.<\/p>\n<p dir=\"auto\">The\u00a0<code>-RequiredResourceFile<\/code>\u00a0parameter can accept either a psd1 or a json file. The psd1 should use the same format as the hashtable above, the json file should use the same format as the json sting above.<\/p>\n<h2 dir=\"auto\"><a id=\"user-content-features-to-expect-in-coming-preview-releases\" class=\"anchor\" href=\"https:\/\/github.com\/PowerShell\/PowerShell-Blog\/blob\/main\/Posts\/2022-05-31-PowerShellGet-Preview-13.md#features-to-expect-in-coming-preview-releases\" aria-hidden=\"true\"><\/a>Features to Expect in Coming Preview Releases<\/h2>\n<p dir=\"auto\">This module is not yet feature complete. Below is a list of features which you can expect to see in the\u00a0<a href=\"https:\/\/github.com\/PowerShell\/PowerShellGet\/projects\/15\">next preview release<\/a>.<\/p>\n<ul dir=\"auto\">\n<li><code>New-ScriptFileInfo<\/code>\u00a0cmdlet<\/li>\n<li><code>Test-ScriptFileInfo<\/code>\u00a0cmdlet<\/li>\n<li><code>Update-ScriptFileInfo<\/code>\u00a0cmdlet<\/li>\n<li><code>Update-ModuleManifest<\/code>\u00a0cmdlet<\/li>\n<li><code>-AuthenticodeCheck<\/code>\u00a0parameter switch for Save, Install, Update<\/li>\n<\/ul>\n<h3 dir=\"auto\"><a id=\"user-content-using-the-compatpowershellget-module\" class=\"anchor\" href=\"https:\/\/github.com\/PowerShell\/PowerShell-Blog\/blob\/main\/Posts\/2022-05-31-PowerShellGet-Preview-13.md#using-the-compatpowershellget-module\" aria-hidden=\"true\"><\/a>Using the CompatPowerShellGet module<\/h3>\n<p dir=\"auto\">CompatPowerShellGet is a compatibility module that allows use of PowerShellGet 2.x (and below) cmdlet syntax with PowerShellGet 3.0 (and above) functionality by making a best effort mapping between the cmdlet interfaces of both versions of the module. New PowerShell scripts that only leverage PowerShellGet v3 cmdlets do not need to use this compatibility module. For example, if a user has the CompatPowerShellGet module installed and runs the command:<\/p>\n<div class=\"highlight highlight-source-powershell notranslate position-relative overflow-auto\">\n<pre><span class=\"pl-c1\">Install-Module<\/span> PowerShellGet <span class=\"pl-k\">-<\/span>MinimumVersion <span class=\"pl-c1\">1<\/span> <span class=\"pl-k\">-<\/span>MaximumVersion <span class=\"pl-c1\">2<\/span> <span class=\"pl-k\">-<\/span>AllowPrerelease<\/pre>\n<\/div>\n<p dir=\"auto\">the CompatPowerShellGet module will get autoloaded into the PowerShell Session and will map the command to PowerShellGet 3.0 syntax:<\/p>\n<div class=\"highlight highlight-source-powershell notranslate position-relative overflow-auto\">\n<pre><span class=\"pl-c1\">Install-PSResource<\/span> PowerShellGet <span class=\"pl-k\">-<\/span>Version <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>[1,2]<span class=\"pl-pds\">\"<\/span><\/span> <span class=\"pl-k\">-<\/span>Prerelease<span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span> <\/span><\/pre>\n<\/div>\n<p dir=\"auto\">The command will then be executed by the PowerShellGet 3.0 implementation. The user will also get a warning to update their script to the new cmdlet interface:<\/p>\n<div class=\"highlight highlight-source-powershell notranslate position-relative overflow-auto\">\n<pre>WARNING: The cmdlet <span class=\"pl-s\"><span class=\"pl-pds\">'<\/span>Install-Module<span class=\"pl-pds\">'<\/span><\/span> is deprecated<span class=\"pl-k\">,<\/span> please use <span class=\"pl-s\"><span class=\"pl-pds\">'<\/span>Install-PSResource<span class=\"pl-pds\">\u2019<\/span><\/span>.<\/pre>\n<\/div>\n<p dir=\"auto\">This module is designed so that users will not need to immediately update their scripts in order to update to the latest version of PowerShell or to begin taking advantage of the performance improvements already available in PowerShellGet 3.0. We still do recommend that authors begin making the minimal changes required to update their scripts to the new cmdlet interface.<\/p>\n<p dir=\"auto\">This compatibility module is designed so that it takes precedence over legacy versions of PowerShellGet. If you have this compatibility module installed and would not like it to be used, you can remove it from the PowerShell session using the Remove-Module command.<\/p>\n<p dir=\"auto\">Please note that this flow is only possible if the user has both the CompatPowerShellGet module installed and the PowerShellGet 3.0 preview module installed. Once PowerShellGet 3.0 is generally available it will be a dependency of CompatPowerShellGet.<\/p>\n<p dir=\"auto\">Please also note that this compatibility module will not be called if you use fully qualified cmdlets. For example, if you use PowerShellGet\\Install-Module this will call a legacy version of PowerShellGet. If this is a common scenario for you, and will be a barrier to migrating to PowerShellGet 3.0 we would appreciate that feedback in\u00a0<a href=\"https:\/\/github.com\/powershell\/powershellget\">our GitHub repository<\/a>.<\/p>\n<h2 dir=\"auto\"><a id=\"user-content-how-to-track-the-development-of-this-module\" class=\"anchor\" href=\"https:\/\/github.com\/PowerShell\/PowerShell-Blog\/blob\/main\/Posts\/2022-05-31-PowerShellGet-Preview-13.md#how-to-track-the-development-of-this-module\" aria-hidden=\"true\"><\/a>How to Track the Development of this Module<\/h2>\n<p dir=\"auto\">GitHub is the best place to track the bugs\/feature requests related to this module. We have used a combination of projects and labels on our GitHub repo to track issues for this upcoming release. We are using the label\u00a0<code>Resolved-3.0<\/code>\u00a0to label issues that we plan to release at some point before we release the module as GA (generally available).<\/p>\n<p dir=\"auto\">To track issues\/features for the next release, please refer to\u00a0<a href=\"https:\/\/github.com\/PowerShell\/PowerShellGet\/projects\/15\">this GitHub project<\/a>.<\/p>\n<h2 dir=\"auto\"><a id=\"user-content-how-to-give-feedback-and-get-support\" class=\"anchor\" href=\"https:\/\/github.com\/PowerShell\/PowerShell-Blog\/blob\/main\/Posts\/2022-05-31-PowerShellGet-Preview-13.md#how-to-give-feedback-and-get-support\" aria-hidden=\"true\"><\/a>How to Give feedback and Get Support<\/h2>\n<p dir=\"auto\">We cannot overstate how critical user feedback is at this stage in the development of the module. Feedback from preview releases help inform design decisions without incurring a breaking change once generally available and used in production.<\/p>\n<p dir=\"auto\">In order to help us to make key decisions around the behavior of the module please give us feedback by opening issues in our\u00a0<a href=\"https:\/\/github.com\/PowerShell\/PowerShellGet\">GitHub repository<\/a>.<\/p>\n<p dir=\"auto\">Sydney Smith<\/p>\n<p dir=\"auto\">PowerShell Team<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are excited to announce that an update to our preview of PowerShellGet 3.0 is now available on the PowerShell Gallery! This release includes support for PSResourceRepository credential persistence, as well as support for RequiredResourceFiles for Install. How to Install PowerShellGet 3.0 Preview 14 Prerequisites Please ensure that you have the latest (non-prerelease) version of [&hellip;]<\/p>\n","protected":false},"author":2299,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[274],"class_list":["post-19514","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-powershellget"],"acf":[],"blog_post_summary":"<p>We are excited to announce that an update to our preview of PowerShellGet 3.0 is now available on the PowerShell Gallery! This release includes support for PSResourceRepository credential persistence, as well as support for RequiredResourceFiles for Install. How to Install PowerShellGet 3.0 Preview 14 Prerequisites Please ensure that you have the latest (non-prerelease) version of [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/19514","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/2299"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=19514"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/19514\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=19514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=19514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=19514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}