After Windows November update (PackageManagement
and PowerShellGet
modules of 1.0.0.1 version) I can't register HTTPS NuGet servers as PSRepository anymore:
Register-PSRepository -Name test -SourceLocation https://some-nuget/api/v2
It returns error:
# Register-PSRepository : The specified Uri 'https://some-nuget/api/v2' for parameter 'SourceLocation' is an invalid Web Uri. Please ensure that it meets the Web Uri requirements.
In my case, the problem was that the (https) server at the source location only supported TLS 1.2.
Running on Windows 7 in PowerShell 5.1, the default was to support only SSL3 and TLS 1.0.
The following allowed it to work:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Register-PSRepository -Name "Artifactory" -SourceLocation "https://example.com/artifactory/api/nuget/powershell/"