如何使用PowerShell模块和NuGet存储库

JFrog支持
2023-01-22 11:07

如果您正在使用NuGet存储库,Artifactory为您提供了使用PowerShell模块的能力。以下是步骤和命令你需要用下面的Artifactory来执行这些交互:

1.注册在Artifactory中创建的Nuget存储库:

注册- psrepository -Name "" -SourceLocation "http://< artifactory - ip:/artifactory/api/nuget/" -PublishLocation "http://< artifactory - ip:/artifactory/api/nuget/" -InstallationPolicy Trusted

< PS-REPOSITORY-NAME >为PowerShell客户端创建的存储库名称是什么<存储库名>是Artifactory中NuGet存储库的名称。

2.发布PowerShell模块:

Publish-Module -Path "" -Repository " -NuGetApiKey ":"

3.找到模块:

Find-Module -Repository

4.下载模块:

Save-Module -Repository -Name -Path

5.如果允许匿名访问(在Artifactory的一般安全配置)是禁用,你可以使用凭据国旗添加用于身份验证的用户凭据。例如:

查找- module -Repository -Credential Save-Module -Repository -Name -Path -Credential

在执行这些命令(带有凭据标志)之后,系统将提示您输入用户的密码。