"The SSL connection could not be established, see inner exception." Issue Installing Microsoft.Graph Module in PowerShell in PowerShell

Bragaglia, Andrea (IT) 5 Reputation points
2025-02-10T17:02:00.11+00:00

Hi everyone,

I'm experiencing an issue when trying to install the Microsoft.Graph module using PowerShell 7. When I run the following command:

Install-Module Microsoft.Graph -Scope CurrentUser -Repository PSGallery -Force -verbose

I receive the following error:User's imageUser's image

I tried checking the inner exception and the full error message, but the command does not return anything:User's image

Additionally, when I run Invoke-WebRequest with the -SkipCertificateCheck flag, I get the following result:

User's image

If I run it without the flag, I receive this error:

User's image

Based on my research, the issue could be related to an incorrect Security Protocol configuration, but in my case, it is correctly set to TLS 1.2:

User's image

Moreover, if I manually access the following URL https://www.powershellgallery.com/api/v2/package/Microsoft.Graph.Authentication/2.25.0 via a web browser, the page loads successfully, and I can download the .nupkg file without any issues.

I have tried these solutions and commands both in normal mode and by running PowerShell as an administrator.

Does anyone have any suggestions on how to resolve this?

Thanks in advance!

Andrea

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,042 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,626 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,809 questions
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.