TIP: PowerShell Gallery – Unable to resolve package source

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….

Tech Wizard

https://techwizard.cloud

https://syscloudpro.com/

PowerShell Cheat Book

 

One thought on “TIP: PowerShell Gallery – Unable to resolve package source

  1. Pingback: CSOM Error – Exception calling “ExecuteQuery” with “0” argument(s): The underlying connection was closed | Tech Wizard

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s