New-ConfigurationPublish
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>]#ApiFromFileNew-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>]#ApiKeyNew-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>]#JFrogNew-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>]#AzureArtifactsNew-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>]#ProfileDescription
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
Publish to PowerShell Gallery (API key from file)
New-ConfigurationPublish -Type PowerShellGallery -FilePath "$env:USERPROFILE\.secrets\psgallery.key" -EnabledPublish to GitHub Releases (token from file)
New-ConfigurationPublish -Type GitHub -FilePath "$env:USERPROFILE\.secrets\github.token" -UserName 'EvotecIT' -RepositoryName 'MyModule' -EnabledPublish to Azure Artifacts (private feed preset)
New-ConfigurationPublish -ProfileName 'Company' -EnabledPublish 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" -EnabledPublish 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' -EnabledPublish 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" -EnabledPublish 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' -EnabledPublish 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' -EnabledPublish 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 -EnabledParameters
- -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. For JFrog, use this only when the feed requires a separate NuGet API key.
- -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.
- -PublishRequiredModules SwitchParameter
- When set, publishes missing manifest RequiredModules to the target repository before publishing the main module.
- -ReplaceExistingAssets SwitchParameter
- Replace same-name assets when deliberately reusing an existing GitHub release.
- -RepositoryApiVersion RepositoryApiVersion
- Repository API version for PSResourceGet registration (v2/v3).
- Possible values:
Auto,V2,V3,ContainerRegistry,Local,NugetServer - -RepositoryCredentialSecret String
- Repository credential secret (password/token) in clear text. For JFrog PAT/basic-auth flows, this is the PAT or access token.
- -RepositoryCredentialSecretEnvironmentVariable String
- 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
- Repository credential secret (password/token) in a clear-text file. For JFrog PAT/basic-auth flows, prefer this over inline token values.
- -RepositoryCredentialUserName String
- Repository credential username (basic auth). For JFrog PAT/basic-auth flows, this is the JFrog user name or email.
- -RepositoryName String
- Repository name override (GitHub or PowerShell repository name).
- -RepositoryPriority Int32
- 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).
- -RequiredModuleSourceRepository String
- Repository used as the source for publishing missing RequiredModules. Defaults to PSGallery.
- -RequiredModuleSourceRepositoryUri String
- Repository URL or local feed path used by managed publishing as the source for missing RequiredModules.
- -ReuseExistingRelease SwitchParameter
- Explicitly reuse an existing GitHub release when its tag is already occupied.
- -Tool PublishTool
- Publishing tool/provider used for repository publishing. Ignored for GitHub publishing.
- Possible values:
Auto,PSResourceGet,PowerShellGet,ManagedModule - -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.
- -UseAsDependencyVersionSource SwitchParameter
- Use this PowerShell repository as the source for resolving Auto/Latest dependency versions.
- -UserName String
- GitHub username (required for GitHub publishing).
- -ApiKey String
- 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
- JFrog Artifactory base URI, for example https://company.jfrog.io/artifactory. PowerShellGet and PSResourceGet URLs are derived automatically.
- -JFrogOidcProvider String
- JFrog OIDC provider name configured in Artifactory. Enables runtime token exchange through JFrog CLI.
- -JFrogOidcProviderType JFrogOidcProviderType
- 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
- CI-issued OIDC token value used by JFrog CLI token exchange. Prefer JFrogOidcTokenIdEnvironmentVariable in CI.
- -JFrogOidcTokenIdEnvironmentVariable String
- Environment variable containing the CI-issued OIDC token value used by JFrog CLI token exchange.
- -JFrogPlatformUri String
- JFrog Platform URL used for JFrog CLI OIDC token exchange. Defaults from JFrogBaseUri when omitted.
- -JFrogRepository String
- JFrog NuGet repository key used to derive PowerShellGet and PSResourceGet endpoints, for example powershell-virtual.
- -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.
- -ProfileName String
- 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.