Evotec

Project

PSPublishModule

PSPublishModule is an open-source PowerShell and .NET project with packages, release history, and technical documentation.

Stars 43
Forks 13
Open issues 1
PowerShell Gallery downloads 13,876
Release v3.0.3
Language: C# Updated: 2026-04-14

API Reference

Cmdlet

New-ConfigurationPublish

Namespace PSPublishModule
Inputs
None
Outputs
System.Object

Provides a way to configure publishing to PowerShell Gallery, GitHub, or private galleries such as Azure Artifacts.

Remarks

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/Auto). For private repositories (for example Azure DevOps Artifacts / private NuGet v3 feeds), provide repository URIs and (optionally) credentials, or use the Azure Artifacts preset parameters to resolve those URIs automatically. To avoid secrets in source control, pass API keys/tokens via -FilePath or environment-specific tooling.

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 -AzureDevOpsOrganization 'contoso' -AzureDevOpsProject 'Platform' -AzureArtifactsFeed 'Modules' -RepositoryCredentialUserName '[email protected]' -RepositoryCredentialSecretFilePath "$env:USERPROFILE\.secrets\azdo.pat" -Enabled
        

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.

Syntax

New-ConfigurationPublish [-DoNotMarkAsPreRelease] [-Enabled] [-EnsureRepositoryRegistered <Boolean>] -FilePath <String> [-Force] [-GenerateReleaseNotes] [-ID <String>] [-OverwriteTagName <String>] [-RepositoryApiVersion <Auto|V2|V3>] [-RepositoryCredentialSecret <String>] [-RepositoryCredentialSecretFilePath <String>] [-RepositoryCredentialUserName <String>] [-RepositoryName <String>] [-RepositoryPriority <Nullable`1>] [-RepositoryPublishUri <String>] [-RepositorySourceUri <String>] [-RepositoryTrusted <Boolean>] [-RepositoryUri <String>] [-Tool <Auto|PSResourceGet|PowerShellGet>] -Type <PowerShellGallery|GitHub> [-UnregisterRepositoryAfterPublish] [-UserName <String>] [<CommonParameters>]
#
Parameter set: ApiFromFile

Parameters

DoNotMarkAsPreRelease SwitchParameter optionalposition: namedpipeline: False
Publish GitHub release as a release even if module prerelease is set.
Enabled SwitchParameter optionalposition: namedpipeline: False
Enable publishing to the chosen destination.
EnsureRepositoryRegistered Boolean optionalposition: namedpipeline: False
When true, registers/updates the repository before publishing. Default: true.
FilePath String requiredposition: namedpipeline: False
API key to be used for publishing in clear text in a file.
Force SwitchParameter optionalposition: namedpipeline: False
Allow publishing lower version of a module on a PowerShell repository.
GenerateReleaseNotes SwitchParameter optionalposition: namedpipeline: False
When set, asks GitHub to generate release notes automatically.
ID String optionalposition: namedpipeline: False
Optional ID of the artefact used for publishing.
OverwriteTagName String optionalposition: namedpipeline: False
Override tag name used for GitHub publishing.
RepositoryApiVersion RepositoryApiVersion optionalposition: namedpipeline: Falsevalues: 3
Repository API version for PSResourceGet registration (v2/v3).
Possible values: Auto, V2, V3
RepositoryCredentialSecret String optionalposition: namedpipeline: False
Repository credential secret (password/token) in clear text.
RepositoryCredentialSecretFilePath String optionalposition: namedpipeline: False
Repository credential secret (password/token) in a clear-text file.
RepositoryCredentialUserName String optionalposition: namedpipeline: False
Repository credential username (basic auth).
RepositoryName String optionalposition: namedpipeline: False
Repository name override (GitHub or PowerShell repository name).
RepositoryPriority Nullable`1 optionalposition: namedpipeline: False
Repository priority for PSResourceGet (lower is higher priority).
RepositoryPublishUri String optionalposition: namedpipeline: False
Repository publish URI (PowerShellGet PublishLocation).
RepositorySourceUri String optionalposition: namedpipeline: False
Repository source URI (PowerShellGet SourceLocation).
RepositoryTrusted Boolean optionalposition: namedpipeline: False
Whether to mark the repository as trusted (avoids prompts). Default: true.
RepositoryUri String optionalposition: namedpipeline: False
Repository base URI (used for both source and publish unless overridden).
Tool PublishTool optionalposition: namedpipeline: Falsevalues: 3
Publishing tool/provider used for repository publishing. Ignored for GitHub publishing.
Possible values: Auto, PSResourceGet, PowerShellGet
Type PublishDestination requiredposition: namedpipeline: Falsevalues: 2
Choose between PowerShellGallery and GitHub.
Possible values: PowerShellGallery, GitHub
UnregisterRepositoryAfterPublish SwitchParameter optionalposition: namedpipeline: False
When set, unregisters the repository after publish if it was created by this run.
UserName String optionalposition: namedpipeline: False
GitHub username (required for GitHub publishing).

Outputs

System.Object

New-ConfigurationPublish -ApiKey <String> [-DoNotMarkAsPreRelease] [-Enabled] [-EnsureRepositoryRegistered <Boolean>] [-Force] [-GenerateReleaseNotes] [-ID <String>] [-OverwriteTagName <String>] [-RepositoryApiVersion <Auto|V2|V3>] [-RepositoryCredentialSecret <String>] [-RepositoryCredentialSecretFilePath <String>] [-RepositoryCredentialUserName <String>] [-RepositoryName <String>] [-RepositoryPriority <Nullable`1>] [-RepositoryPublishUri <String>] [-RepositorySourceUri <String>] [-RepositoryTrusted <Boolean>] [-RepositoryUri <String>] [-Tool <Auto|PSResourceGet|PowerShellGet>] -Type <PowerShellGallery|GitHub> [-UnregisterRepositoryAfterPublish] [-UserName <String>] [<CommonParameters>]
#
Parameter set: ApiKey

Parameters

ApiKey String requiredposition: namedpipeline: False
API key to be used for publishing in clear text.
DoNotMarkAsPreRelease SwitchParameter optionalposition: namedpipeline: False
Publish GitHub release as a release even if module prerelease is set.
Enabled SwitchParameter optionalposition: namedpipeline: False
Enable publishing to the chosen destination.
EnsureRepositoryRegistered Boolean optionalposition: namedpipeline: False
When true, registers/updates the repository before publishing. Default: true.
Force SwitchParameter optionalposition: namedpipeline: False
Allow publishing lower version of a module on a PowerShell repository.
GenerateReleaseNotes SwitchParameter optionalposition: namedpipeline: False
When set, asks GitHub to generate release notes automatically.
ID String optionalposition: namedpipeline: False
Optional ID of the artefact used for publishing.
OverwriteTagName String optionalposition: namedpipeline: False
Override tag name used for GitHub publishing.
RepositoryApiVersion RepositoryApiVersion optionalposition: namedpipeline: Falsevalues: 3
Repository API version for PSResourceGet registration (v2/v3).
Possible values: Auto, V2, V3
RepositoryCredentialSecret String optionalposition: namedpipeline: False
Repository credential secret (password/token) in clear text.
RepositoryCredentialSecretFilePath String optionalposition: namedpipeline: False
Repository credential secret (password/token) in a clear-text file.
RepositoryCredentialUserName String optionalposition: namedpipeline: False
Repository credential username (basic auth).
RepositoryName String optionalposition: namedpipeline: False
Repository name override (GitHub or PowerShell repository name).
RepositoryPriority Nullable`1 optionalposition: namedpipeline: False
Repository priority for PSResourceGet (lower is higher priority).
RepositoryPublishUri String optionalposition: namedpipeline: False
Repository publish URI (PowerShellGet PublishLocation).
RepositorySourceUri String optionalposition: namedpipeline: False
Repository source URI (PowerShellGet SourceLocation).
RepositoryTrusted Boolean optionalposition: namedpipeline: False
Whether to mark the repository as trusted (avoids prompts). Default: true.
RepositoryUri String optionalposition: namedpipeline: False
Repository base URI (used for both source and publish unless overridden).
Tool PublishTool optionalposition: namedpipeline: Falsevalues: 3
Publishing tool/provider used for repository publishing. Ignored for GitHub publishing.
Possible values: Auto, PSResourceGet, PowerShellGet
Type PublishDestination requiredposition: namedpipeline: Falsevalues: 2
Choose between PowerShellGallery and GitHub.
Possible values: PowerShellGallery, GitHub
UnregisterRepositoryAfterPublish SwitchParameter optionalposition: namedpipeline: False
When set, unregisters the repository after publish if it was created by this run.
UserName String optionalposition: namedpipeline: False
GitHub username (required for GitHub publishing).

Outputs

System.Object

New-ConfigurationPublish -AzureArtifactsFeed <String> -AzureDevOpsOrganization <String> [-AzureDevOpsProject <String>] [-Enabled] [-EnsureRepositoryRegistered <Boolean>] [-Force] [-ID <String>] [-RepositoryApiVersion <Auto|V2|V3>] [-RepositoryCredentialSecret <String>] [-RepositoryCredentialSecretFilePath <String>] [-RepositoryCredentialUserName <String>] [-RepositoryName <String>] [-RepositoryPriority <Nullable`1>] [-RepositoryTrusted <Boolean>] [-Tool <Auto|PSResourceGet|PowerShellGet>] [-UnregisterRepositoryAfterPublish] [<CommonParameters>]
#
Parameter set: AzureArtifacts

Parameters

AzureArtifactsFeed String requiredposition: namedpipeline: False
Azure Artifacts feed name for the private gallery preset.
AzureDevOpsOrganization String requiredposition: namedpipeline: False
Azure DevOps organization name for the Azure Artifacts preset.
AzureDevOpsProject String optionalposition: namedpipeline: False
Optional Azure DevOps project name for project-scoped feeds.
Enabled SwitchParameter optionalposition: namedpipeline: False
Enable publishing to the chosen destination.
EnsureRepositoryRegistered Boolean optionalposition: namedpipeline: False
When true, registers/updates the repository before publishing. Default: true.
Force SwitchParameter optionalposition: namedpipeline: False
Allow publishing lower version of a module on a PowerShell repository.
ID String optionalposition: namedpipeline: False
Optional ID of the artefact used for publishing.
RepositoryApiVersion RepositoryApiVersion optionalposition: namedpipeline: Falsevalues: 3
Repository API version for PSResourceGet registration (v2/v3).
Possible values: Auto, V2, V3
RepositoryCredentialSecret String optionalposition: namedpipeline: False
Repository credential secret (password/token) in clear text.
RepositoryCredentialSecretFilePath String optionalposition: namedpipeline: False
Repository credential secret (password/token) in a clear-text file.
RepositoryCredentialUserName String optionalposition: namedpipeline: False
Repository credential username (basic auth).
RepositoryName String optionalposition: namedpipeline: False
Repository name override (GitHub or PowerShell repository name).
RepositoryPriority Nullable`1 optionalposition: namedpipeline: False
Repository priority for PSResourceGet (lower is higher priority).
RepositoryTrusted Boolean optionalposition: namedpipeline: False
Whether to mark the repository as trusted (avoids prompts). Default: true.
Tool PublishTool optionalposition: namedpipeline: Falsevalues: 3
Publishing tool/provider used for repository publishing. Ignored for GitHub publishing.
Possible values: Auto, PSResourceGet, PowerShellGet
UnregisterRepositoryAfterPublish SwitchParameter optionalposition: namedpipeline: False
When set, unregisters the repository after publish if it was created by this run.

Outputs

System.Object