Unable to publish an update to an existing Powershell module to our Artifact Store.
In my script I register my repositories and Package Sources:
Register-PSRepository -Name ArtifactoryDev -SourceLocation $NuGetDevUrl -PublishLocation $NuGetDevUrl -InstallationPolicy Trusted -Credential $Cred
Register-PackageSource -Name ArtifactoryDev -ProviderName NuGet -Location $NuGetDevUrl -Trusted -Credential $Cred
I then, near the end of my script try to publish the module to update our existing one in Artifactory:
Publish-Module -Path $Module.Path -Repository $RepositoryName -NuGetApiKey "$($ArtifactoryUser):$($ArtifactoryToken)" -Credential $Cred -Force -ErrorAction Stop -Verbose -Debug
I am getting the following error
2019-06-27T12:12:24.2452350Z ##[error]PackageManagement\Get-PackageSource : Unable to find repository 'ArtifactoryDev'. Use Get-PSRepository to see all
available repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.1.5\PSModule.psm1:9360 char:35
+ ... ckageSources = PackageManagement\Get-PackageSource @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power...etPackageSource:GetPackageSource) [Get-PackageSource]
, Exception
+ FullyQualifiedErrorId : SourceNotFound,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackageSource
To check the repository does exist I thought to call Get-PackageSource -Name ArtifatoryDev
and I can see it in the results:
Name ProviderName IsTrusted Location
---- ------------ --------- --------
ArtifactoryDev PowerShellGet True http://myremoterepo