Archive for March, 2022

Updating TLS in PowerShell to Allow Set-PSRepository to Run

March 19, 2022 Leave a comment

I was recently working on a client server and need to install the Az PowerShell module. I opened and administrator window and typed

Install-Module Az

and received this error:

WARNING: Unable to find module repositories.

Searching the error, I was told to run

Register-PSRepository -Default

The command completed without an error, but I got the same error when trying to install the Az module.

Some additional digging led me to check the TLS version PowerShell was running. It turned out it was using TLS 1.0. Running this command updated TLS to 1.2:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

and allowed the Register-Repository command to execute successfully.

Thanks for reading and I hope this helps.

Categories: Azure, PowerShell Tags: , ,