The PowerShell client can be used to install and publish NuGet packages.
To connect the PowerShell NuGet client to Artifactory:
You must perform the following steps:
Create credentials for authentication
Add this repository as a source for use with Modules and/or Scripts
Configure credentials
In the command line, use the following command to generate credentials:
$credential = New-Object PSCredential('<USER>',$(ConvertTo-SecureString '<TOKEN>' -AsPlainText -Force))For example:
$credential = New-Object PSCredential('johnfrog',$(ConvertTo-SecureString 'RANDOM_TOKENlROXloME5ubjlY' -AsPlainText -Force))Add Source (Modules / Scripts)
Use the following command to add a repository:
Register modules
To register this repository to your modules SourceLocation, use the following command:
Register-PSRepository -Name artifactory -SourceLocation "https://<YOUR_JFROG_DOMAIN>/artifactory/api/nuget/<REPOSITORY_NAME>" -PublishLocation "https://<YOUR_JFROG_DOMAIN>/artifactory/api/nuget/<REPOSITORY_NAME>" -InstallationPolicy Trusted -Credential $credential
Register scripts
To register this repository to your scripts ScriptSourceLocation, use the following command:
Register-PSRepository -Name artifactory -ScriptSourceLocation "https://<YOUR_JFROG_DOMAIN>/artifactory/api/nuget/<REPOSITORY_NAME>" -ScriptPublishLocation "https://<YOUR_JFROG_DOMAIN>/artifactory/api/nuget/<REPOSITORY_NAME>" -InstallationPolicy Trusted -Credential $credential