API Reference
New-ConfigurationPublish
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
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 'user@contoso.com' -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>]
#
ApiFromFileParameters
- DoNotMarkAsPreRelease SwitchParameter
- Publish GitHub release as a release even if module prerelease is set.
- Enabled SwitchParameter
- Enable publishing to the chosen destination.
- EnsureRepositoryRegistered Boolean
- When true, registers/updates the repository before publishing. Default: true.
- FilePath String
- API key to be used for publishing in clear text in a file.
- Force SwitchParameter
- Allow publishing lower version of a module on a PowerShell repository.
- GenerateReleaseNotes SwitchParameter
- When set, asks GitHub to generate release notes automatically.
- ID String
- Optional ID of the artefact used for publishing.
- OverwriteTagName String
- Override tag name used for GitHub publishing.
- RepositoryApiVersion RepositoryApiVersion
- Repository API version for PSResourceGet registration (v2/v3).
- Possible values:
Auto,V2,V3 - RepositoryCredentialSecret String
- Repository credential secret (password/token) in clear text.
- RepositoryCredentialSecretFilePath String
- Repository credential secret (password/token) in a clear-text file.
- RepositoryCredentialUserName String
- Repository credential username (basic auth).
- RepositoryName String
- Repository name override (GitHub or PowerShell repository name).
- RepositoryPriority Nullable`1
- Repository priority for PSResourceGet (lower is higher priority).
- RepositoryPublishUri String
- Repository publish URI (PowerShellGet PublishLocation).
- RepositorySourceUri String
- Repository source URI (PowerShellGet SourceLocation).
- RepositoryTrusted Boolean
- Whether to mark the repository as trusted (avoids prompts). Default: true.
- RepositoryUri String
- Repository base URI (used for both source and publish unless overridden).
- Tool PublishTool
- Publishing tool/provider used for repository publishing. Ignored for GitHub publishing.
- Possible values:
Auto,PSResourceGet,PowerShellGet - Type PublishDestination
- Choose between PowerShellGallery and GitHub.
- Possible values:
PowerShellGallery,GitHub - UnregisterRepositoryAfterPublish SwitchParameter
- When set, unregisters the repository after publish if it was created by this run.
- UserName String
- 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>]
#
ApiKeyParameters
- ApiKey String
- API key to be used for publishing in clear text.
- DoNotMarkAsPreRelease SwitchParameter
- Publish GitHub release as a release even if module prerelease is set.
- Enabled SwitchParameter
- Enable publishing to the chosen destination.
- EnsureRepositoryRegistered Boolean
- When true, registers/updates the repository before publishing. Default: true.
- Force SwitchParameter
- Allow publishing lower version of a module on a PowerShell repository.
- GenerateReleaseNotes SwitchParameter
- When set, asks GitHub to generate release notes automatically.
- ID String
- Optional ID of the artefact used for publishing.
- OverwriteTagName String
- Override tag name used for GitHub publishing.
- RepositoryApiVersion RepositoryApiVersion
- Repository API version for PSResourceGet registration (v2/v3).
- Possible values:
Auto,V2,V3 - RepositoryCredentialSecret String
- Repository credential secret (password/token) in clear text.
- RepositoryCredentialSecretFilePath String
- Repository credential secret (password/token) in a clear-text file.
- RepositoryCredentialUserName String
- Repository credential username (basic auth).
- RepositoryName String
- Repository name override (GitHub or PowerShell repository name).
- RepositoryPriority Nullable`1
- Repository priority for PSResourceGet (lower is higher priority).
- RepositoryPublishUri String
- Repository publish URI (PowerShellGet PublishLocation).
- RepositorySourceUri String
- Repository source URI (PowerShellGet SourceLocation).
- RepositoryTrusted Boolean
- Whether to mark the repository as trusted (avoids prompts). Default: true.
- RepositoryUri String
- Repository base URI (used for both source and publish unless overridden).
- Tool PublishTool
- Publishing tool/provider used for repository publishing. Ignored for GitHub publishing.
- Possible values:
Auto,PSResourceGet,PowerShellGet - Type PublishDestination
- Choose between PowerShellGallery and GitHub.
- Possible values:
PowerShellGallery,GitHub - UnregisterRepositoryAfterPublish SwitchParameter
- When set, unregisters the repository after publish if it was created by this run.
- UserName String
- 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>]
#
AzureArtifactsParameters
- AzureArtifactsFeed String
- Azure Artifacts feed name for the private gallery preset.
- AzureDevOpsOrganization String
- Azure DevOps organization name for the Azure Artifacts preset.
- AzureDevOpsProject String
- Optional Azure DevOps project name for project-scoped feeds.
- Enabled SwitchParameter
- Enable publishing to the chosen destination.
- EnsureRepositoryRegistered Boolean
- When true, registers/updates the repository before publishing. Default: true.
- Force SwitchParameter
- Allow publishing lower version of a module on a PowerShell repository.
- ID String
- Optional ID of the artefact used for publishing.
- RepositoryApiVersion RepositoryApiVersion
- Repository API version for PSResourceGet registration (v2/v3).
- Possible values:
Auto,V2,V3 - RepositoryCredentialSecret String
- Repository credential secret (password/token) in clear text.
- RepositoryCredentialSecretFilePath String
- Repository credential secret (password/token) in a clear-text file.
- RepositoryCredentialUserName String
- Repository credential username (basic auth).
- RepositoryName String
- Repository name override (GitHub or PowerShell repository name).
- RepositoryPriority Nullable`1
- Repository priority for PSResourceGet (lower is higher priority).
- RepositoryTrusted Boolean
- Whether to mark the repository as trusted (avoids prompts). Default: true.
- Tool PublishTool
- Publishing tool/provider used for repository publishing. Ignored for GitHub publishing.
- Possible values:
Auto,PSResourceGet,PowerShellGet - UnregisterRepositoryAfterPublish SwitchParameter
- When set, unregisters the repository after publish if it was created by this run.
Outputs
System.Object