Forum Discussion
Trying to Install-Module AzureAD but Get-PSRepository "WARNING: Unable to find module repositories."
- Jun 18, 2020
I followed this article, and the "Microsoft way" didn't work. I needed to execute the second block of commands:
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 Register-PSRepository -Default -Verbose Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted
Thank you all for your help. Solution found!
https://blogs.technet.microsoft.com/keithmayer/2016/01/06/quick-tip-using-azure-powershell-with-web-proxy-and-fiddler/ at Step 2 (Optional) – Add Proxy Credentials to Script:
To use Windows credentials for proxy authentication, you can add …
[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
...and when I added that in a new PowerShell session, Get-PSRepository shows the expected:
Name InstallationPolicy SourceLocation
---- ------------------ --------------
PSGallery Untrusted https://www.powershellgallery.com/api/v2/
...and Install-Module AzureADPreview works, so obviously a proxy issue all along.
Reinier SPRUIJT Thank you for the solution. It helped me as well.