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.186
Language: C# Updated: 2026-11-04
Command

Initialize-ManagedModuleRepository

Module
PSPublishModule
Inputs
None
Outputs
PSPublishModule.ModuleRepositoryOnboardingResult PSPublishModule.ModuleRepositoryRegistrationResult

Performs one-command onboarding for managed module repository profiles.

Syntax

Initialize-ManagedModuleRepository
[-BootstrapForce]
[-BootstrapPath <String>]
[-BootstrapProfileFileName <String>]
[-BootstrapScriptName <String>]
[-CredentialSecret <String>]
[-CredentialSecretFilePath <String>]
[-CredentialUserName <String>]
[-InstallModule <String[]>]
[-InstallPrerequisites]
[-ProfileName] <String>
[-PromptForCredential]
[-Scope <User|Machine|All>]
[-SkipConnect]
[<CommonParameters>]
#
Parameter set: Profile
Initialize-ManagedModuleRepository
[-BootstrapForce]
[-BootstrapPath <String>]
[-BootstrapProfileFileName <String>]
[-BootstrapScriptName <String>]
[-CredentialSecret <String>]
[-CredentialSecretFilePath <String>]
[-CredentialUserName <String>]
[-InstallModule <String[]>]
[-InstallPrerequisites]
[-Overwrite]
[-Path] <String>
[[-ProfileName] <String>]
[-PromptForCredential]
[-Scope <User|Machine|All>]
[-SkipConnect]
[<CommonParameters>]
#
Parameter set: Import
Initialize-ManagedModuleRepository
[-AzureArtifactsFeed <String>]
[-AzureDevOpsOrganization <String>]
[-AzureDevOpsProject <String>]
[-BootstrapForce]
[-BootstrapMode <Auto|ExistingSession|CredentialPrompt|JFrogCli>]
[-BootstrapPath <String>]
[-BootstrapProfileFileName <String>]
[-BootstrapScriptName <String>]
[-CredentialSecret <String>]
[-CredentialSecretFilePath <String>]
[-CredentialUserName <String>]
[-GitHubOwner <String>]
[-InstallModule <String[]>]
[-InstallPrerequisites]
[-JFrogBaseUri <String>]
[-JFrogRepository <String>]
[-Priority <Int32>]
[-ProfileName] <String>
[-PromptForCredential]
[-Provider <PrivateGalleryProvider>]
[-Repository <String>]
[-RepositoryName <String>]
[-RepositoryPublishUri <String>]
[-RepositorySourceUri <String>]
[-RepositoryUri <String>]
[-Scope <User|Machine|All>]
[-SkipConnect]
[-Tool <Auto|PSResourceGet|PowerShellGet|Both>]
[-Trusted <Boolean>]
[<CommonParameters>]
#
Parameter set: Repository
Initialize-ManagedModuleRepository
[-BootstrapForce]
[-BootstrapPath <String>]
[-BootstrapProfileFileName <String>]
[-BootstrapScriptName <String>]
[-CredentialSecret <String>]
[-CredentialSecretFilePath <String>]
[-CredentialUserName <String>]
[-InstallModule <String[]>]
[-InstallPrerequisites]
-MicrosoftArtifactRegistry
[-Priority <Int32>]
[-PromptForCredential]
[-RepositoryName <String>]
[-Scope <User|Machine|All>]
[-SkipConnect]
[-Tool <Auto|PSResourceGet|PowerShellGet|Both>]
[-Trusted <Boolean>]
[<CommonParameters>]
#
Parameter set: MicrosoftArtifactRegistry

Description

This cmdlet is the workstation or build-agent onboarding entry point for managed module repositories. It can use an existing saved profile, import a non-secret profile JSON file, or create a profile from feed details. Unless -SkipConnect is used, it then installs requested prerequisites, registers/probes native provider state where needed, and validates authenticated access through the selected bootstrap mode. It can also write a distributable non-secret bootstrap package for other machines.

Examples

Onboard from a managed profile file

Initialize-ManagedModuleRepository -Path .\Company.repository.json -ProfileName Company -Overwrite -InstallPrerequisites

Imports the non-secret profile, installs/refreshes prerequisites, registers the repository, and triggers the Azure Artifacts credential-provider login flow when needed.

Create and connect an Entra-first Azure Artifacts profile

Initialize-ManagedModuleRepository -ProfileName Company -Organization contoso -Project Platform -Feed Modules -InstallPrerequisites

Saves an Entra-first profile and connects the workstation in one command.

Verify profile metadata without connecting

Initialize-ManagedModuleRepository -ProfileName Company -SkipConnect

Returns profile and local prerequisite readiness without registering or probing the repository.

Parameters

-BootstrapForce SwitchParameter optional
Overwrite existing bootstrap files when BootstrapPath is used.
-BootstrapPath String optional
Optional output directory for a non-secret onboarding package that imports the selected profiles and can install starter modules.
-BootstrapProfileFileName String optional
Generated profile JSON file name when BootstrapPath is used.
-BootstrapScriptName String optional
Generated bootstrap script file name when BootstrapPath is used.
-CredentialSecret String optionalaliases: Password, Token
Optional repository credential secret for credential-prompt fallback environments.
-CredentialSecretFilePath String optionalaliases: CredentialPath, TokenPath
Optional path to a file containing the repository credential secret.
-CredentialUserName String optionalaliases: UserName
Optional repository credential username for credential-prompt fallback environments.
-InstallModule String[] optionalaliases: ModuleName
Optional module names written into the bootstrap script as starter managed installs.
-InstallPrerequisites SwitchParameter optional
Installs missing private-gallery prerequisites before connecting, including the PSResourceGet version required by the selected bootstrap mode and the Azure Artifacts credential provider.
-ProfileName String required in Profile, Repositoryposition: 0aliases: Name, Profilesets: Profile, Import, Repository
Saved repository profile name. When used with Path, selects one imported profile from the file. When used with Azure Artifacts feed details, creates that profile name.
-PromptForCredential SwitchParameter optionalaliases: Interactive
Prompts interactively for repository credentials in credential-prompt fallback environments.
-Scope ModuleRepositoryProfileScope optional
Profile store scope. Existing profiles default to user-then-machine lookup; profile creation/import defaults to the current user's store unless Machine is specified.
Possible values: User, Machine, All
-SkipConnect SwitchParameter optional
Save/import/test the profile but do not register, connect, or probe the repository.
-Overwrite SwitchParameter optionalsets: Import
Replace saved profiles with matching names when importing from Path.
-Path String requiredposition: 0sets: Import
Source JSON profile file exported with Get-ManagedModuleRepository -ExportPath.
-AzureArtifactsFeed String optionalaliases: Feedsets: Repository
Azure Artifacts feed name.
-AzureDevOpsOrganization String optionalaliases: Organizationsets: Repository
Azure DevOps organization name.
-AzureDevOpsProject String optionalaliases: Projectsets: Repository
Optional Azure DevOps project name for project-scoped feeds.
-BootstrapMode PrivateGalleryBootstrapMode optionalaliases: Modesets: Repository
Bootstrap/authentication mode saved in a new profile. Defaults to ExistingSession for Azure Artifacts Credential Provider login.
Possible values: Auto, ExistingSession, CredentialPrompt, JFrogCli
-GitHubOwner String optionalaliases: Namespace, Ownersets: Repository
GitHub user or organization namespace for GitHub Packages. Defaults from Repository when omitted.
-JFrogBaseUri String optionalsets: Repository
JFrog Artifactory base URI, for example https://company.jfrog.io/artifactory.
-JFrogRepository String optionalsets: Repository
JFrog NuGet repository key. Defaults from Repository when omitted.
-Priority Int32 optionalsets: Repository, MicrosoftArtifactRegistry
Optional PSResourceGet repository priority.
-Provider PrivateGalleryProvider optionalsets: Repository
Private gallery provider.
Possible values: AzureArtifacts, Azure, JFrog, NuGet, GitHubPackages, GitHub
-Repository String optionalsets: Repository
Provider repository/feed id. For Azure this is the feed when AzureArtifactsFeed is omitted; for JFrog this is the Artifactory NuGet repository key.
-RepositoryName String optionalsets: Repository, MicrosoftArtifactRegistry
Optional local repository name override. Defaults to the profile name for new Azure Artifacts profiles.
-RepositoryPublishUri String optionalsets: Repository
PowerShellGet publish URI for generic/JFrog feeds.
-RepositorySourceUri String optionalsets: Repository
PowerShellGet source URI for generic/JFrog feeds.
-RepositoryUri String optionalsets: Repository
PSResourceGet v3 repository URI for generic/JFrog feeds.
-Tool RepositoryRegistrationTool optionalsets: Repository, MicrosoftArtifactRegistry
Registration strategy saved in a new profile. Defaults to PSResourceGet for Entra-first Azure Artifacts use.
Possible values: Auto, PSResourceGet, PowerShellGet, Both
-Trusted Boolean optionalsets: Repository, MicrosoftArtifactRegistry
When true, marks the repository as trusted during registration.
-MicrosoftArtifactRegistry SwitchParameter requiredsets: MicrosoftArtifactRegistry
Initializes the public Microsoft Artifact Registry PowerShell repository.

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.

Outputs

PSPublishModule.ModuleRepositoryOnboardingResult: Result returned by Initialize-ManagedModuleRepository for managed repository onboarding. PSPublishModule.ModuleRepositoryRegistrationResult: Result returned when registering or refreshing a private module repository.