I'm trying to enable modern authentication for an O365 tenant, and then instructions say to import the Exchange Online Management module. I don't have that module, so those same instructions say to install it by using
Install-Module -Name ExchangeOnlineManagement -RequiredVersion 2.0.5
But then I get this error
WARNING: Unable to resolve package source 'https://www.powershellgallery.com/api/v2'.
PackageManagement\Install-Package : No match was found for the specified search criteria and module name
'ExchangeOnlineManagement'. Try Get-PSRepository to see all available registered module repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1772 char:21
... $null = PackageManagement\Install-Package @PSBoundParameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], E
ception
FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
Just in case I did also run this to check
Get-PSRepository
And the result was
Name InstallationPolicy SourceLocation
---- ------------------ --------------
PSGallery Untrusted https://www.powershellgallery.com/api/v2
And that seems correct. So does anybody know why it's not working.
Thanks!
CodePudding user response:
Just replying with the answer in case it helps anyone else who stumbles across this in future. It was a TLS issue, and the fix was simply:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
After that everything worked as it should.