I was working on Azure automation for one of our clients and on installing Az module from PowerShell gallery below error was received.
Warning: Unable to resolve package source ‘https://www.powershellgallery.com/api/v2’.
Server on which I was trying to install this module was Windows Server 2016.
On researching on internet, I found this is because connection should be on tls1.2
Enter below command in powershell shell as administrator and this issue will be fixed.
You will now be able to install the module.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
I just want to share this tip for the users that follow my blog, although you will find this when searching the Internet as many people have already faced this issue.
Thanks for reading….