As of April 2020 the Powershell gallery block connections with TLS below 1.2
TLS 1.0 and 1.2 has been deprecated for some time, but now its actively blocked on the PS gallery. Due to this we start seeing various errors when downloading packages, like NuGet, and the error we see is like:
- WARNING: Unable to download from URI.
- WARNING: Unable to download the list of available providers. Check your internet connection.
- Unable to find package provider ‘NuGet’. It may not be imported yet.
So to verify the TLS version enabled on the machine:
If only TLS is available it means TLS version 1.0, and you cannot use PS gallery.
To enable TLS 1.1 and 1.2 for the machine in general execute the following (enables both x86 and x64):
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
Restart you PS session and you will be able to use the PS gallery again.