PowerShellGetv2
PowerShellGetv2 copied to clipboard
When an Azure DEVOps Project URL has spaces in it Register-PSRepository fails despite VSS_NUGET_EXTERNAL_FEED_ENDPOINTS being set
Steps to reproduce
- Create an Azure DEVOps Project with a space in the URL, e.g. "https://dev.azure.com/MyOrganisation/Space Project"
az devops create -name "Space Project"
-
Create an Artifact feed (https://docs.microsoft.com/en-us/azure/devops/artifacts/get-started-nuget?view=azure-devops&tabs=windows#create-a-feed)
-
Publish the NuGet Package (https://docs.microsoft.com/en-us/azure/devops/artifacts/get-started-nuget?view=azure-devops&tabs=windows#publish-a-nuget-package-by-using-the-command-line)
-
Register the PsRepository
$env:NUGET_PLUGIN_PATHS = "c:\users\MyUser\.nuget\plugins\netfx\CredentialProvider.Microsoft\CredentialProvider.Microsoft.ex"
$env:VSS_NUGET_EXTERNAL_FEED_ENDPOINTS= @"
{
"endpointCredentials":[
{
endpoint: "https://pkgs.dev.azure.com/MyOrganisation/Space Project/_packaging/MyFeedName/nuget/v2",
Username: "PAT"
Password: "mypat"
}
]
}
"@
Register-PsRepository `
-Name:MyRepository `
-SourceLocation:"https://pkgs.dev.azure.com/MyOrganisation/Space Project/_packaging/MyFeedName/nuget/v2" `
-PublishLocation:"https://pkgs.dev.azure.com/MyOrganisation/Space Project/_packaging/MyFeedName/nuget/v2" `
-InstallationPolicy:Trusted
Expected behavior
Package Source with Name: MyFeedName added successfully
Actual behavior
The specified repository 'MyRepository' is unauthorized and cannot be registered. Try running with -Credential
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 7.2.1
PSEdition Core
GitCommitId 7.2.1
OS Microsoft Windows 10.0.17763
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
> Get-Module -ListAvailable PowerShellGet,PackageManagement
Directory: C:\program files\powershell\7\Modules
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Script 1.4.7 PackageManagement Desk {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource…}
Script 2.2.5 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability…}
Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Script 1.4.7 PackageManagement Desk {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource…}
Binary 1.0.0.1 PackageManagement Desk {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource…}
Script 2.2.5 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability…}
Script 1.0.0.1 PowerShellGet Desk {Install-Module, Find-Module, Save-Module, Update-Module…}
> Get-PackageProvider -ListAvailable
Name Version DynamicOptions
---- ------- --------------
DockerProvider 0.0.0.3 Update
NuGet 3.0.0.1 Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate
PowerShellGet 2.2.5.0 PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, AllowPrereleaseVersions, Filter, Tag,…
PowerShellGet 1.0.0.1