Welcome to the module toolkit designed to work easily with internal repository. If you work with internal repositories, there are two problems.
- Getting users onboarded, this can be complex and difficult.
- Every single call requires specified credentials.
The toolkit will help to solve these problems. Using the bootstrap script, users can get onboarded by running a single line of code. The module itself and the related function will be used to call the internal repository without entering the credentials every call.
To use this module directly, you need to install it from the PowerShell Gallery:
Install-PSResource PSGetInternal -Scope CurrentUser
Alternatively, you may want to deploy it via bootstrap script to solve the fundamental chicken/egg problem of deploying the tools to deploy tools. For details on this see below.
Only use one time to register the repository. Is not needed, if bootstrap got used.
# Register the trusted repository "Internal-Repository" with SourceLocation "<Repository-URL>". Generate a credential file for this repository.
$cred = Get-Credential -UserName "<UserPrincipalName>" -Message "Provide PAT used to authenticate to the internal PowerShell Gallery"
Set-GIRepository -Name "Internal-Repository" -SourceLocation "<Repository-URL>" -InstallationPolicy "Trusted" -Credential $cred
# Register the trusted repository "Internal-Repository" with SourceLocation "<Repository-URL>". Generate a credential file for this repository and mark it as default.
$cred = Get-Credential -UserName "<UserPrincipalName>" -Message "Provide PAT used to authenticate to the internal PowerShell Gallery"
Set-GIRepository -Name "Internal-Repository" -SourceLocation "<Repository-URL>" -InstallationPolicy "Trusted" -Credential $cred -Default
# Install the module "<Internal-ModuleName>" from the configured Internal-Repository repository.
Install-GIModule -Name "<Internal-ModuleName>"
- Provide a network share for the bootstrap script, where specific users have access to.
- Download bootstrap.ps1 from GitHub repository and store it on the network share.
- Perform the following command in PowerShell from a computer with access to both that network share and the PSGallery:
Be aware that "<network share path>" should be the same path, where the bootstrap script is stored!
# Save the module "PSGetInternal" to "<network share path>".
Save-PSResource -Name "PSGetInternal" -Path "<network share path>" -Repository "PSGallery"
- Edit the bootstrap script to your internal repository. Add your personal default settings under the first paramblock:
$RepositoryName = "<Name of the internal Repository>"
$Url = "<Url of the internal Repository>"