Project

PSPublishModule

Build, test, version, sign, and publish PowerShell modules with reusable PowerForge pipelines.

Stars 48
Forks 16
PowerShell Gallery downloads 17,213
Release v3.0.169
Language: C# Updated: 2026-10-17
Command

New-ConfigurationPublish

Module PSPublishModule
Inputs
None

Provides a way to configure publishing to PowerShell Gallery, GitHub, JFrog Artifactory, or other private PowerShell module repositories.

Syntax

New-ConfigurationPublish [-DoNotMarkAsPreRelease] [-Enabled] [-EnsureRepositoryRegistered <Boolean>] [-FilePath <String>] [-Force] [-GenerateReleaseNotes] [-ID <String>] [-OverwriteTagName <String>] [-PublishRequiredModules] [-ReplaceExistingAssets] [-RepositoryApiVersion <RepositoryApiVersion>] [-RepositoryCredentialSecret <String>] [-RepositoryCredentialSecretEnvironmentVariable <String>] [-RepositoryCredentialSecretFilePath <String>] [-RepositoryCredentialUserName <String>] [-RepositoryName <String>] [-RepositoryPriority <Int32>] [-RepositoryPublishUri <String>] [-RepositorySourceUri <String>] [-RepositoryTrusted <Boolean>] [-RepositoryUri <String>] [-RequiredModuleSourceRepository <String>] [-RequiredModuleSourceRepositoryUri <String>] [-ReuseExistingRelease] [-Tool <Auto|PSResourceGet|PowerShellGet|ManagedModule>] -Type <PowerShellGallery|GitHub> [-UnregisterRepositoryAfterPublish] [-UseAsDependencyVersionSource] [-UserName <String>] [<CommonParameters>]
#
Parameter set: ApiFromFile
New-ConfigurationPublish [-ApiKey <String>] [-DoNotMarkAsPreRelease] [-Enabled] [-EnsureRepositoryRegistered <Boolean>] [-Force] [-GenerateReleaseNotes] [-ID <String>] [-OverwriteTagName <String>] [-PublishRequiredModules] [-ReplaceExistingAssets] [-RepositoryApiVersion <RepositoryApiVersion>] [-RepositoryCredentialSecret <String>] [-RepositoryCredentialSecretEnvironmentVariable <String>] [-RepositoryCredentialSecretFilePath <String>] [-RepositoryCredentialUserName <String>] [-RepositoryName <String>] [-RepositoryPriority <Int32>] [-RepositoryPublishUri <String>] [-RepositorySourceUri <String>] [-RepositoryTrusted <Boolean>] [-RepositoryUri <String>] [-RequiredModuleSourceRepository <String>] [-RequiredModuleSourceRepositoryUri <String>] [-ReuseExistingRelease] [-Tool <Auto|PSResourceGet|PowerShellGet|ManagedModule>] -Type <PowerShellGallery|GitHub> [-UnregisterRepositoryAfterPublish] [-UseAsDependencyVersionSource] [-UserName <String>] [<CommonParameters>]
#
Parameter set: ApiKey
New-ConfigurationPublish [-ApiKey <String>] [-Enabled] [-EnsureRepositoryRegistered <Boolean>] [-FilePath <String>] [-Force] [-ID <String>] -JFrogBaseUri <String> [-JFrogOidcProvider <String>] [-JFrogOidcProviderType <GitHub|Azure|GenericOidc>] [-JFrogOidcTokenId <String>] [-JFrogOidcTokenIdEnvironmentVariable <String>] [-JFrogPlatformUri <String>] -JFrogRepository <String> [-PublishRequiredModules] [-RepositoryApiVersion <RepositoryApiVersion>] [-RepositoryCredentialSecret <String>] [-RepositoryCredentialSecretEnvironmentVariable <String>] [-RepositoryCredentialSecretFilePath <String>] [-RepositoryCredentialUserName <String>] [-RepositoryName <String>] [-RepositoryPriority <Int32>] [-RepositoryPublishUri <String>] [-RepositorySourceUri <String>] [-RepositoryTrusted <Boolean>] [-RepositoryUri <String>] [-RequiredModuleSourceRepository <String>] [-RequiredModuleSourceRepositoryUri <String>] [-Tool <Auto|PSResourceGet|PowerShellGet|ManagedModule>] [-Type <PowerShellGallery|GitHub>] [-UnregisterRepositoryAfterPublish] [-UseAsDependencyVersionSource] [<CommonParameters>]
#
Parameter set: JFrog
New-ConfigurationPublish -AzureArtifactsFeed <String> -AzureDevOpsOrganization <String> [-AzureDevOpsProject <String>] [-Enabled] [-EnsureRepositoryRegistered <Boolean>] [-Force] [-ID <String>] [-PublishRequiredModules] [-RepositoryApiVersion <RepositoryApiVersion>] [-RepositoryCredentialSecret <String>] [-RepositoryCredentialSecretEnvironmentVariable <String>] [-RepositoryCredentialSecretFilePath <String>] [-RepositoryCredentialUserName <String>] [-RepositoryName <String>] [-RepositoryPriority <Int32>] [-RepositoryTrusted <Boolean>] [-RequiredModuleSourceRepository <String>] [-RequiredModuleSourceRepositoryUri <String>] [-Tool <Auto|PSResourceGet|PowerShellGet|ManagedModule>] [-UnregisterRepositoryAfterPublish] [-UseAsDependencyVersionSource] [<CommonParameters>]
#
Parameter set: AzureArtifacts
New-ConfigurationPublish [-ApiKey <String>] [-Enabled] [-FilePath <String>] [-Force] [-ID <String>] -ProfileName <String> [-PublishRequiredModules] [-RepositoryCredentialSecret <String>] [-RepositoryCredentialSecretEnvironmentVariable <String>] [-RepositoryCredentialSecretFilePath <String>] [-RepositoryCredentialUserName <String>] [-RequiredModuleSourceRepository <String>] [-RequiredModuleSourceRepositoryUri <String>] [<CommonParameters>]
#
Parameter set: Profile

Description

This cmdlet emits publish configuration consumed by Invoke-ModuleBuild / Build-Module. Use -Type to choose a destination. For repository publishing, -Tool selects the provider (PowerShellGet/PSResourceGet/ManagedModule/Auto).

For private repositories (for example Azure DevOps Artifacts, JFrog Artifactory, GitHub Packages, or private NuGet v3 feeds), provide repository URIs and (optionally) credentials, or use provider-specific preset parameters to resolve those URIs automatically. To avoid secrets in source control, pass API keys/tokens via -FilePath or environment-specific tooling.

JFrog Artifactory can be configured directly with -JFrogBaseUri and -JFrogRepository. For PAT/basic-auth feeds, use repository credentials only. Add -FilePath or -ApiKey only when the feed requires a separate NuGet API key for package push.

Examples

Authored help example

Publish to PowerShell Gallery (API key from file)

New-ConfigurationPublish -Type PowerShellGallery -FilePath "$env:USERPROFILE\.secrets\psgallery.key" -Enabled

Publish to GitHub Releases (token from file)

New-ConfigurationPublish -Type GitHub -FilePath "$env:USERPROFILE\.secrets\github.token" -UserName 'EvotecIT' -RepositoryName 'MyModule' -Enabled

Publish to Azure Artifacts (private feed preset)

New-ConfigurationPublish -ProfileName 'Company' -Enabled

Publish to JFrog Artifactory with PAT/basic authentication

New-ConfigurationPublish -JFrogBaseUri 'https://company.jfrog.io/artifactory' -JFrogRepository 'powershell-virtual' -RepositoryName 'JFrogPS' -Tool PSResourceGet -RepositoryCredentialUserName 'name@company.com' -RepositoryCredentialSecretFilePath "$env:USERPROFILE\.secrets\jfrog-pat.txt" -Enabled

Publish to JFrog Artifactory with a clear-text PAT for local testing

New-ConfigurationPublish -JFrogBaseUri 'https://company.jfrog.io/artifactory' -JFrogRepository 'powershell-virtual' -RepositoryName 'JFrogPS' -Tool PSResourceGet -RepositoryCredentialUserName 'name@company.com' -RepositoryCredentialSecret 'temporary-pat' -Enabled

Publish to JFrog Artifactory with a separate NuGet API key

New-ConfigurationPublish -JFrogBaseUri 'https://company.jfrog.io/artifactory' -JFrogRepository 'powershell-virtual' -RepositoryName 'JFrogPS' -Tool PSResourceGet -FilePath "$env:USERPROFILE\.secrets\jfrog-nuget-api-key.txt" -RepositoryCredentialUserName 'name@company.com' -RepositoryCredentialSecretFilePath "$env:USERPROFILE\.secrets\jfrog-pat.txt" -Enabled

Publish to JFrog Artifactory with a PAT/access token stored in an environment variable

New-ConfigurationPublish -JFrogBaseUri 'https://company.jfrog.io/artifactory' -JFrogRepository 'powershell-virtual' -RepositoryName 'JFrogPS' -Tool PSResourceGet -RepositoryCredentialUserName 'name@company.com' -RepositoryCredentialSecretEnvironmentVariable 'JFROG_ACCESS_TOKEN' -Enabled

Publish to JFrog Artifactory with CI OIDC token exchange

New-ConfigurationPublish -JFrogBaseUri 'https://company.jfrog.io/artifactory' -JFrogRepository 'powershell-virtual' -RepositoryName 'JFrogPS' -Tool PSResourceGet -JFrogOidcProvider 'azure-oidc' -JFrogOidcProviderType Azure -JFrogOidcTokenIdEnvironmentVariable 'JFROG_CLI_OIDC_EXCHANGE_TOKEN_ID' -Enabled

Publish missing RequiredModules into a private repository before publishing the module

New-ConfigurationPublish -JFrogBaseUri 'https://company.jfrog.io/artifactory' -JFrogRepository 'powershell-virtual' -RepositoryName 'JFrogPS' -Tool PSResourceGet -RepositoryCredentialUserName 'name@company.com' -RepositoryCredentialSecretEnvironmentVariable 'JFROG_ACCESS_TOKEN' -PublishRequiredModules -RequiredModuleSourceRepository PSGallery -Enabled

Parameters

-DoNotMarkAsPreRelease SwitchParameter optionalsets: ApiFromFile, ApiKey
Publish GitHub release as a release even if module prerelease is set.
-Enabled SwitchParameter optional
Enable publishing to the chosen destination.
-EnsureRepositoryRegistered Boolean optionalsets: ApiFromFile, ApiKey, JFrog, AzureArtifacts
When true, registers/updates the repository before publishing. Default: true.
-FilePath String optionalsets: ApiFromFile, JFrog, Profile
API key to be used for publishing in clear text in a file. For JFrog, use this only when the feed requires a separate NuGet API key.
-Force SwitchParameter optional
Allow publishing lower version of a module on a PowerShell repository.
-GenerateReleaseNotes SwitchParameter optionalsets: ApiFromFile, ApiKey
When set, asks GitHub to generate release notes automatically.
-ID String optional
Optional ID of the artefact used for publishing.
-OverwriteTagName String optionalsets: ApiFromFile, ApiKey
Override tag name used for GitHub publishing.
-PublishRequiredModules SwitchParameter optional
When set, publishes missing manifest RequiredModules to the target repository before publishing the main module.
-ReplaceExistingAssets SwitchParameter optionalsets: ApiFromFile, ApiKey
Replace same-name assets when deliberately reusing an existing GitHub release.
-RepositoryApiVersion RepositoryApiVersion optionalsets: ApiFromFile, ApiKey, JFrog, AzureArtifacts
Repository API version for PSResourceGet registration (v2/v3).
Possible values: Auto, V2, V3, ContainerRegistry, Local, NugetServer
-RepositoryCredentialSecret String optional
Repository credential secret (password/token) in clear text. For JFrog PAT/basic-auth flows, this is the PAT or access token.
-RepositoryCredentialSecretEnvironmentVariable String optional
Environment variable containing the repository credential secret (password/token). For JFrog PAT/access-token flows, this can be JFROG_ACCESS_TOKEN or a CI secret variable.
-RepositoryCredentialSecretFilePath String optional
Repository credential secret (password/token) in a clear-text file. For JFrog PAT/basic-auth flows, prefer this over inline token values.
-RepositoryCredentialUserName String optional
Repository credential username (basic auth). For JFrog PAT/basic-auth flows, this is the JFrog user name or email.
-RepositoryName String optionalsets: ApiFromFile, ApiKey, JFrog, AzureArtifacts
Repository name override (GitHub or PowerShell repository name).
-RepositoryPriority Int32 optionalsets: ApiFromFile, ApiKey, JFrog, AzureArtifacts
Repository priority for PSResourceGet (lower is higher priority).
-RepositoryPublishUri String optionalsets: ApiFromFile, ApiKey, JFrog
Repository publish URI (PowerShellGet PublishLocation).
-RepositorySourceUri String optionalsets: ApiFromFile, ApiKey, JFrog
Repository source URI (PowerShellGet SourceLocation).
-RepositoryTrusted Boolean optionalsets: ApiFromFile, ApiKey, JFrog, AzureArtifacts
Whether to mark the repository as trusted (avoids prompts). Default: true.
-RepositoryUri String optionalsets: ApiFromFile, ApiKey, JFrog
Repository base URI (used for both source and publish unless overridden).
-RequiredModuleSourceRepository String optional
Repository used as the source for publishing missing RequiredModules. Defaults to PSGallery.
-RequiredModuleSourceRepositoryUri String optional
Repository URL or local feed path used by managed publishing as the source for missing RequiredModules.
-ReuseExistingRelease SwitchParameter optionalsets: ApiFromFile, ApiKey
Explicitly reuse an existing GitHub release when its tag is already occupied.
-Tool PublishTool optionalsets: ApiFromFile, ApiKey, JFrog, AzureArtifacts
Publishing tool/provider used for repository publishing. Ignored for GitHub publishing.
Possible values: Auto, PSResourceGet, PowerShellGet, ManagedModule
-Type PublishDestination required in ApiFromFile, ApiKeysets: ApiFromFile, ApiKey, JFrog
Choose between PowerShellGallery and GitHub.
Possible values: PowerShellGallery, GitHub
-UnregisterRepositoryAfterPublish SwitchParameter optionalsets: ApiFromFile, ApiKey, JFrog, AzureArtifacts
When set, unregisters the repository after publish if it was created by this run.
-UseAsDependencyVersionSource SwitchParameter optionalsets: ApiFromFile, ApiKey, JFrog, AzureArtifacts
Use this PowerShell repository as the source for resolving Auto/Latest dependency versions.
-UserName String optionalsets: ApiFromFile, ApiKey
GitHub username (required for GitHub publishing).
-ApiKey String optionalsets: ApiKey, JFrog, Profile
API key to be used for publishing in clear text. For JFrog, use this only when the feed requires a separate NuGet API key.
-JFrogBaseUri String requiredsets: JFrog
JFrog Artifactory base URI, for example https://company.jfrog.io/artifactory. PowerShellGet and PSResourceGet URLs are derived automatically.
-JFrogOidcProvider String optionalsets: JFrog
JFrog OIDC provider name configured in Artifactory. Enables runtime token exchange through JFrog CLI.
-JFrogOidcProviderType JFrogOidcProviderType optionalsets: JFrog
JFrog OIDC provider implementation passed to JFrog CLI. Use Azure for Azure DevOps or Entra-backed OIDC mappings.
Possible values: GitHub, Azure, GenericOidc
-JFrogOidcTokenId String optionalsets: JFrog
CI-issued OIDC token value used by JFrog CLI token exchange. Prefer JFrogOidcTokenIdEnvironmentVariable in CI.
-JFrogOidcTokenIdEnvironmentVariable String optionalsets: JFrog
Environment variable containing the CI-issued OIDC token value used by JFrog CLI token exchange.
-JFrogPlatformUri String optionalsets: JFrog
JFrog Platform URL used for JFrog CLI OIDC token exchange. Defaults from JFrogBaseUri when omitted.
-JFrogRepository String requiredsets: JFrog
JFrog NuGet repository key used to derive PowerShellGet and PSResourceGet endpoints, for example powershell-virtual.
-AzureArtifactsFeed String requiredsets: AzureArtifacts
Azure Artifacts feed name for the private gallery preset.
-AzureDevOpsOrganization String requiredsets: AzureArtifacts
Azure DevOps organization name for the Azure Artifacts preset.
-AzureDevOpsProject String optionalsets: AzureArtifacts
Optional Azure DevOps project name for project-scoped feeds.
-ProfileName String requiredaliases: Profilesets: Profile
Saved private gallery profile name for Azure Artifacts publishing.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.